summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/frontend/emu_window.cpp26
-rw-r--r--src/core/hle/function_wrappers.h4
-rw-r--r--src/core/hle/service/ptm/ptm.cpp2
-rw-r--r--src/core/hle/service/soc_u.cpp71
-rw-r--r--src/core/hle/svc.cpp4
-rw-r--r--src/core/settings.h10
6 files changed, 61 insertions, 56 deletions
diff --git a/src/core/frontend/emu_window.cpp b/src/core/frontend/emu_window.cpp
index 73a44bfe7..5fdb3a7e8 100644
--- a/src/core/frontend/emu_window.cpp
+++ b/src/core/frontend/emu_window.cpp
@@ -89,17 +89,21 @@ void EmuWindow::GyroscopeChanged(float x, float y, float z) {
void EmuWindow::UpdateCurrentFramebufferLayout(unsigned width, unsigned height) {
Layout::FramebufferLayout layout;
- switch (Settings::values.layout_option) {
- case Settings::LayoutOption::SingleScreen:
- layout = Layout::SingleFrameLayout(width, height, Settings::values.swap_screen);
- break;
- case Settings::LayoutOption::LargeScreen:
- layout = Layout::LargeFrameLayout(width, height, Settings::values.swap_screen);
- break;
- case Settings::LayoutOption::Default:
- default:
- layout = Layout::DefaultFrameLayout(width, height, Settings::values.swap_screen);
- break;
+ if (Settings::values.custom_layout == true) {
+ layout = Layout::CustomFrameLayout(width, height);
+ } else {
+ switch (Settings::values.layout_option) {
+ case Settings::LayoutOption::SingleScreen:
+ layout = Layout::SingleFrameLayout(width, height, Settings::values.swap_screen);
+ break;
+ case Settings::LayoutOption::LargeScreen:
+ layout = Layout::LargeFrameLayout(width, height, Settings::values.swap_screen);
+ break;
+ case Settings::LayoutOption::Default:
+ default:
+ layout = Layout::DefaultFrameLayout(width, height, Settings::values.swap_screen);
+ break;
+ }
}
NotifyFramebufferLayoutChanged(layout);
}
diff --git a/src/core/hle/function_wrappers.h b/src/core/hle/function_wrappers.h
index 7875971ce..f6eb900f0 100644
--- a/src/core/hle/function_wrappers.h
+++ b/src/core/hle/function_wrappers.h
@@ -256,9 +256,9 @@ void Wrap() {
func(((s64)PARAM(1) << 32) | PARAM(0));
}
-template <void func(const char*)>
+template <void func(const char*, int len)>
void Wrap() {
- func((char*)Memory::GetPointer(PARAM(0)));
+ func((char*)Memory::GetPointer(PARAM(0)), PARAM(1));
}
template <void func(u8)>
diff --git a/src/core/hle/service/ptm/ptm.cpp b/src/core/hle/service/ptm/ptm.cpp
index 8ff808fd9..2542f8303 100644
--- a/src/core/hle/service/ptm/ptm.cpp
+++ b/src/core/hle/service/ptm/ptm.cpp
@@ -134,9 +134,9 @@ void Init() {
ASSERT_MSG(archive_result.Succeeded(), "Could not open the PTM SharedExtSaveData archive!");
FileSys::Path gamecoin_path("/gamecoin.dat");
+ Service::FS::CreateFileInArchive(*archive_result, gamecoin_path, sizeof(GameCoin));
FileSys::Mode open_mode = {};
open_mode.write_flag.Assign(1);
- open_mode.create_flag.Assign(1);
// Open the file and write the default gamecoin information
auto gamecoin_result =
Service::FS::OpenFileFromArchive(*archive_result, gamecoin_path, open_mode);
diff --git a/src/core/hle/service/soc_u.cpp b/src/core/hle/service/soc_u.cpp
index dcc5c3c90..530614e6f 100644
--- a/src/core/hle/service/soc_u.cpp
+++ b/src/core/hle/service/soc_u.cpp
@@ -362,18 +362,18 @@ static void Socket(Interface* self) {
return;
}
- u32 socket_handle = static_cast<u32>(::socket(domain, type, protocol));
+ u32 ret = static_cast<u32>(::socket(domain, type, protocol));
- if ((s32)socket_handle != SOCKET_ERROR_VALUE)
- open_sockets[socket_handle] = {socket_handle, true};
+ if ((s32)ret != SOCKET_ERROR_VALUE)
+ open_sockets[ret] = {ret, true};
int result = 0;
- if ((s32)socket_handle == SOCKET_ERROR_VALUE)
- result = TranslateError(GET_ERRNO);
+ if ((s32)ret == SOCKET_ERROR_VALUE)
+ ret = TranslateError(GET_ERRNO);
cmd_buffer[0] = IPC::MakeHeader(2, 2, 0);
cmd_buffer[1] = result;
- cmd_buffer[2] = socket_handle;
+ cmd_buffer[2] = ret;
}
static void Bind(Interface* self) {
@@ -393,15 +393,15 @@ static void Bind(Interface* self) {
sockaddr sock_addr = CTRSockAddr::ToPlatform(ctr_sock_addr);
- int res = ::bind(socket_handle, &sock_addr, std::max<u32>(sizeof(sock_addr), len));
+ int ret = ::bind(socket_handle, &sock_addr, std::max<u32>(sizeof(sock_addr), len));
int result = 0;
- if (res != 0)
- result = TranslateError(GET_ERRNO);
+ if (ret != 0)
+ ret = TranslateError(GET_ERRNO);
cmd_buffer[0] = IPC::MakeHeader(5, 2, 0);
cmd_buffer[1] = result;
- cmd_buffer[2] = res;
+ cmd_buffer[2] = ret;
}
static void Fcntl(Interface* self) {
@@ -426,8 +426,7 @@ static void Fcntl(Interface* self) {
#else
int ret = ::fcntl(socket_handle, F_GETFL, 0);
if (ret == SOCKET_ERROR_VALUE) {
- result = TranslateError(GET_ERRNO);
- posix_ret = -1;
+ posix_ret = TranslateError(GET_ERRNO);
return;
}
posix_ret = 0;
@@ -439,8 +438,7 @@ static void Fcntl(Interface* self) {
unsigned long tmp = (ctr_arg & 4 /* O_NONBLOCK */) ? 1 : 0;
int ret = ioctlsocket(socket_handle, FIONBIO, &tmp);
if (ret == SOCKET_ERROR_VALUE) {
- result = TranslateError(GET_ERRNO);
- posix_ret = -1;
+ posix_ret = TranslateError(GET_ERRNO);
return;
}
auto iter = open_sockets.find(socket_handle);
@@ -449,8 +447,7 @@ static void Fcntl(Interface* self) {
#else
int flags = ::fcntl(socket_handle, F_GETFL, 0);
if (flags == SOCKET_ERROR_VALUE) {
- result = TranslateError(GET_ERRNO);
- posix_ret = -1;
+ posix_ret = TranslateError(GET_ERRNO);
return;
}
@@ -460,15 +457,13 @@ static void Fcntl(Interface* self) {
int ret = ::fcntl(socket_handle, F_SETFL, flags);
if (ret == SOCKET_ERROR_VALUE) {
- result = TranslateError(GET_ERRNO);
- posix_ret = -1;
+ posix_ret = TranslateError(GET_ERRNO);
return;
}
#endif
} else {
LOG_ERROR(Service_SOC, "Unsupported command (%d) in fcntl call", ctr_cmd);
- result = TranslateError(EINVAL); // TODO: Find the correct error
- posix_ret = -1;
+ posix_ret = TranslateError(EINVAL); // TODO: Find the correct error
return;
}
}
@@ -481,7 +476,7 @@ static void Listen(Interface* self) {
int ret = ::listen(socket_handle, backlog);
int result = 0;
if (ret != 0)
- result = TranslateError(GET_ERRNO);
+ ret = TranslateError(GET_ERRNO);
cmd_buffer[0] = IPC::MakeHeader(3, 2, 0);
cmd_buffer[1] = result;
@@ -504,7 +499,7 @@ static void Accept(Interface* self) {
int result = 0;
if ((s32)ret == SOCKET_ERROR_VALUE) {
- result = TranslateError(GET_ERRNO);
+ ret = TranslateError(GET_ERRNO);
} else {
CTRSockAddr ctr_addr = CTRSockAddr::FromPlatform(addr);
Memory::WriteBlock(cmd_buffer[0x104 >> 2], &ctr_addr, sizeof(ctr_addr));
@@ -545,7 +540,7 @@ static void Close(Interface* self) {
int result = 0;
if (ret != 0)
- result = TranslateError(GET_ERRNO);
+ ret = TranslateError(GET_ERRNO);
cmd_buffer[2] = ret;
cmd_buffer[1] = result;
@@ -589,7 +584,7 @@ static void SendTo(Interface* self) {
int result = 0;
if (ret == SOCKET_ERROR_VALUE)
- result = TranslateError(GET_ERRNO);
+ ret = TranslateError(GET_ERRNO);
cmd_buffer[2] = ret;
cmd_buffer[1] = result;
@@ -638,7 +633,7 @@ static void RecvFrom(Interface* self) {
int result = 0;
int total_received = ret;
if (ret == SOCKET_ERROR_VALUE) {
- result = TranslateError(GET_ERRNO);
+ ret = TranslateError(GET_ERRNO);
total_received = 0;
} else {
// Write only the data we received to avoid overwriting parts of the buffer with zeros
@@ -673,7 +668,7 @@ static void Poll(Interface* self) {
std::vector<pollfd> platform_pollfd(nfds);
std::transform(ctr_fds.begin(), ctr_fds.end(), platform_pollfd.begin(), CTRPollFD::ToPlatform);
- const int ret = ::poll(platform_pollfd.data(), nfds, timeout);
+ int ret = ::poll(platform_pollfd.data(), nfds, timeout);
// Now update the output pollfd structure
std::transform(platform_pollfd.begin(), platform_pollfd.end(), ctr_fds.begin(),
@@ -683,7 +678,7 @@ static void Poll(Interface* self) {
int result = 0;
if (ret == SOCKET_ERROR_VALUE)
- result = TranslateError(GET_ERRNO);
+ ret = TranslateError(GET_ERRNO);
cmd_buffer[1] = result;
cmd_buffer[2] = ret;
@@ -710,7 +705,7 @@ static void GetSockName(Interface* self) {
int result = 0;
if (ret != 0)
- result = TranslateError(GET_ERRNO);
+ ret = TranslateError(GET_ERRNO);
cmd_buffer[2] = ret;
cmd_buffer[1] = result;
@@ -724,7 +719,7 @@ static void Shutdown(Interface* self) {
int ret = ::shutdown(socket_handle, how);
int result = 0;
if (ret != 0)
- result = TranslateError(GET_ERRNO);
+ ret = TranslateError(GET_ERRNO);
cmd_buffer[2] = ret;
cmd_buffer[1] = result;
}
@@ -750,7 +745,7 @@ static void GetPeerName(Interface* self) {
int result = 0;
if (ret != 0)
- result = TranslateError(GET_ERRNO);
+ ret = TranslateError(GET_ERRNO);
cmd_buffer[2] = ret;
cmd_buffer[1] = result;
@@ -777,7 +772,7 @@ static void Connect(Interface* self) {
int ret = ::connect(socket_handle, &input_addr, sizeof(input_addr));
int result = 0;
if (ret != 0)
- result = TranslateError(GET_ERRNO);
+ ret = TranslateError(GET_ERRNO);
cmd_buffer[0] = IPC::MakeHeader(6, 2, 0);
cmd_buffer[1] = result;
@@ -815,7 +810,7 @@ static void GetSockOpt(Interface* self) {
int optname = TranslateSockOpt(cmd_buffer[3]);
socklen_t optlen = (socklen_t)cmd_buffer[4];
- int ret = -1;
+ int ret = 0;
int err = 0;
if (optname < 0) {
@@ -830,9 +825,8 @@ static void GetSockOpt(Interface* self) {
// >> 2 = convert to u32 offset instead of byte offset (cmd_buffer = u32*)
char* optval = reinterpret_cast<char*>(Memory::GetPointer(cmd_buffer[0x104 >> 2]));
- ret = ::getsockopt(socket_handle, level, optname, optval, &optlen);
- err = 0;
- if (ret == SOCKET_ERROR_VALUE) {
+ err = ::getsockopt(socket_handle, level, optname, optval, &optlen);
+ if (err == SOCKET_ERROR_VALUE) {
err = TranslateError(GET_ERRNO);
}
}
@@ -849,7 +843,7 @@ static void SetSockOpt(Interface* self) {
u32 level = cmd_buffer[2];
int optname = TranslateSockOpt(cmd_buffer[3]);
- int ret = -1;
+ int ret = 0;
int err = 0;
if (optname < 0) {
@@ -862,9 +856,8 @@ static void SetSockOpt(Interface* self) {
socklen_t optlen = static_cast<socklen_t>(cmd_buffer[4]);
const char* optval = reinterpret_cast<const char*>(Memory::GetPointer(cmd_buffer[8]));
- ret = static_cast<u32>(::setsockopt(socket_handle, level, optname, optval, optlen));
- err = 0;
- if (ret == SOCKET_ERROR_VALUE) {
+ err = static_cast<u32>(::setsockopt(socket_handle, level, optname, optval, optlen));
+ if (err == SOCKET_ERROR_VALUE) {
err = TranslateError(GET_ERRNO);
}
}
diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp
index 4e0c3fb8b..2db823c61 100644
--- a/src/core/hle/svc.cpp
+++ b/src/core/hle/svc.cpp
@@ -467,8 +467,8 @@ static void Break(u8 break_reason) {
}
/// Used to output a message on a debug hardware unit - does nothing on a retail unit
-static void OutputDebugString(const char* string) {
- LOG_DEBUG(Debug_Emulated, "%s", string);
+static void OutputDebugString(const char* string, int len) {
+ LOG_DEBUG(Debug_Emulated, "%.*s", len, string);
}
/// Get resource limit
diff --git a/src/core/settings.h b/src/core/settings.h
index d1a9f0da8..03c64c94c 100644
--- a/src/core/settings.h
+++ b/src/core/settings.h
@@ -15,7 +15,6 @@ enum class LayoutOption {
Default,
SingleScreen,
LargeScreen,
- Custom,
};
namespace NativeButton {
@@ -99,6 +98,15 @@ struct Values {
LayoutOption layout_option;
bool swap_screen;
+ bool custom_layout;
+ u16 custom_top_left;
+ u16 custom_top_top;
+ u16 custom_top_right;
+ u16 custom_top_bottom;
+ u16 custom_bottom_left;
+ u16 custom_bottom_top;
+ u16 custom_bottom_right;
+ u16 custom_bottom_bottom;
float bg_red;
float bg_green;