Merge branch 'main' into linux-overlay

This commit is contained in:
Tom Lally 2022-09-02 10:23:48 +01:00
commit 5303f8011d
12 changed files with 74 additions and 64 deletions

View file

@ -29,7 +29,7 @@ typedef struct
/* +0x0C */ uint8 ukn0C[0xA];
/* +0x16 */ uint8 ukn16[2];
/* +0x18 */ uint16 ukn18;
/* +0x1A */ uint16be miiName[10];
/* +0x1A */ uint16le miiName[10];
/* +0x2E */ uint16 ukn2E;
/* +0x30 */ uint8 ukn30[96 - 0x30];
}FFLData_t;
@ -102,7 +102,7 @@ Account::Account(uint32 persistent_id, std::wstring_view mii_name)
FFLData_t* fflData = (FFLData_t*)m_mii_data.data();
const auto tmp_name = GetMiiName();
memset(fflData->miiName, 0, sizeof(fflData->miiName));
std::copy(tmp_name.cbegin(), tmp_name.cend(), fflData->miiName);
std::copy(tmp_name.begin(), tmp_name.end(), fflData->miiName);
// calculate checksum
uint32 crcCounter = 0;

View file

@ -48,7 +48,7 @@ typedef struct
char country[8];
// Mii
FFLData_t miiData;
uint16be miiNickname[ACT_NICKNAME_LENGTH];
uint16le miiNickname[ACT_NICKNAME_LENGTH];
}actAccountData_t;
#define IOSU_ACT_ACCOUNT_MAX_COUNT (0xC)
@ -103,6 +103,15 @@ void iosuAct_loadAccounts()
const auto& first_acc = Account::GetAccount(persistent_id);
FillAccountData(first_acc, online_enabled, counter);
++counter;
// enable multiple accounts for cafe functions (badly tested)
//for (const auto& account : Account::GetAccounts())
//{
// if (first_acc.GetPersistentId() != account.GetPersistentId())
// {
// FillAccountData(account, online_enabled, counter);
// ++counter;
// }
//}
cemuLog_force(L"IOSU_ACT: using account {} in first slot", first_acc.GetMiiName());

View file

@ -25,7 +25,7 @@ typedef struct
/* +0x0C */ uint8 ukn0C[0xA];
/* +0x16 */ uint8 ukn16[2];
/* +0x18 */ uint16 ukn18;
/* +0x1A */ uint16be miiName[MII_FFL_NAME_LENGTH];
/* +0x1A */ uint16le miiName[MII_FFL_NAME_LENGTH];
/* +0x2E */ uint16 ukn2E;
/* +0x30 */ uint8 ukn30[MII_FFL_STORAGE_SIZE-0x30];
}FFLData_t;

View file

@ -138,11 +138,9 @@ void nnActExport_GetNumOfAccounts(PPCInterpreter_t* hCPU)
void nnActExport_IsSlotOccupied(PPCInterpreter_t* hCPU)
{
forceLogDebug_printf("nn_act.IsSlotOccupied(%d)\n", hCPU->gpr[3]);
sint32 slotIndex = (sint32)hCPU->gpr[3] - 1; // first slot is 1
bool isOccupied = false;
if( slotIndex == 0 )
isOccupied = true;
osLib_returnFromFunction(hCPU, isOccupied?1:0);
ppcDefineParamU8(slot, 0);
osLib_returnFromFunction(hCPU, nn::act::GetPersistentIdEx(slot) != 0 ? 1 : 0);
}
uint32 GetAccountIdEx(char* accountId, uint8 slot)

View file

@ -61,7 +61,7 @@ namespace NAPI
return true;
}
void _ACTSetCommonHeaderParameters(CurlRequestHelper& req)
void _ACTSetCommonHeaderParameters(CurlRequestHelper& req, AuthInfo& authInfo)
{
req.addHeaderField("X-Nintendo-Platform-ID", "1");
req.addHeaderField("X-Nintendo-Device-Type", "2");
@ -71,7 +71,10 @@ namespace NAPI
req.addHeaderField("Accept", "*/*");
req.addHeaderField("X-Nintendo-System-Version", "0260");
if(authInfo.region == CafeConsoleRegion::USA)
req.addHeaderField("X-Nintendo-System-Version", "0270");
else
req.addHeaderField("X-Nintendo-System-Version", "0260");
}
void _ACTSetDeviceParameters(CurlRequestHelper& req, AuthInfo& authInfo)
@ -143,7 +146,7 @@ namespace NAPI
CurlRequestHelper req;
req.initate(fmt::format("{}/v1/api/oauth20/access_token/generate", LaunchSettings::GetActURLPrefix()), CurlRequestHelper::SERVER_SSL_CONTEXT::ACT);
_ACTSetCommonHeaderParameters(req);
_ACTSetCommonHeaderParameters(req, authInfo);
_ACTSetDeviceParameters(req, authInfo);
_ACTSetRegionAndCountryParameters(req, authInfo);
req.addHeaderField("X-Nintendo-Device-Cert", authInfo.deviceCertBase64);
@ -229,7 +232,7 @@ namespace NAPI
req.initate(fmt::format("{}/v1/api/people/@me/profile", LaunchSettings::GetActURLPrefix()), CurlRequestHelper::SERVER_SSL_CONTEXT::ACT);
_ACTSetCommonHeaderParameters(req);
_ACTSetCommonHeaderParameters(req, authInfo);
_ACTSetDeviceParameters(req, authInfo);
// get oauth2 token
@ -295,7 +298,7 @@ namespace NAPI
// do request
CurlRequestHelper req;
req.initate(fmt::format("{}/v1/api/provider/nex_token/@me?game_server_id={:08X}", LaunchSettings::GetActURLPrefix(), serverId), CurlRequestHelper::SERVER_SSL_CONTEXT::ACT);
_ACTSetCommonHeaderParameters(req);
_ACTSetCommonHeaderParameters(req, authInfo);
_ACTSetDeviceParameters(req, authInfo);
_ACTSetRegionAndCountryParameters(req, authInfo);
req.addHeaderField("X-Nintendo-FPD-Version", "0000");
@ -448,7 +451,7 @@ namespace NAPI
// do request
CurlRequestHelper req;
req.initate(fmt::format("{}/v1/api/provider/service_token/@me?client_id={}", LaunchSettings::GetActURLPrefix(), clientId), CurlRequestHelper::SERVER_SSL_CONTEXT::ACT);
_ACTSetCommonHeaderParameters(req);
_ACTSetCommonHeaderParameters(req, authInfo);
_ACTSetDeviceParameters(req, authInfo);
_ACTSetRegionAndCountryParameters(req, authInfo);
req.addHeaderField("X-Nintendo-FPD-Version", "0000");
@ -519,7 +522,7 @@ namespace NAPI
// do request
CurlRequestHelper req;
req.initate(fmt::format("{}/v1/api/admin/mapped_ids?input_type=user_id&output_type=pid&input={}", LaunchSettings::GetActURLPrefix(), nnid), CurlRequestHelper::SERVER_SSL_CONTEXT::ACT);
_ACTSetCommonHeaderParameters(req);
_ACTSetCommonHeaderParameters(req, authInfo);
_ACTSetDeviceParameters(req, authInfo);
_ACTSetRegionAndCountryParameters(req, authInfo);
req.addHeaderField("X-Nintendo-FPD-Version", "0000");

View file

@ -11,18 +11,19 @@ target_sources(CemuCommon
PRIVATE
windows/platform.cpp
windows/platform.h
ExceptionHandler/ExceptionHandler_win32.cpp
)
else()
target_sources(CemuCommon
PRIVATE
unix/platform.cpp
unix/platform.h
ExceptionHandler/ExceptionHandler_posix.cpp
)
endif()
target_sources(CemuCommon
PRIVATE
ExceptionHandler/ExceptionHandler.cpp
ExceptionHandler/ExceptionHandler.h
)

View file

@ -0,0 +1,36 @@
#include <signal.h>
#include <execinfo.h>
void handler_SIGSEGV(int sig)
{
printf("SIGSEGV!\n");
void *array[32];
size_t size;
// get void*'s for all entries on the stack
size = backtrace(array, 32);
// print out all the frames to stderr
fprintf(stderr, "Error: signal %d:\n", sig);
backtrace_symbols_fd(array, size, STDERR_FILENO);
exit(1);
}
void handler_SIGINT(int sig)
{
/*
* Received when pressing CTRL + C in a console
* Ideally should be exiting cleanly after saving settings but currently
* there's no clean exit pathway (at least on linux) and exiting the app
* by any mean ends up with a SIGABRT from the standard library destroying
* threads.
*/
exit(0);
}
void ExceptionHandler_init()
{
signal(SIGSEGV, handler_SIGSEGV);
signal(SIGINT, handler_SIGINT);
}

View file

@ -1,12 +1,6 @@
#include "Common/precompiled.h"
#include "Cafe/CafeSystem.h"
#if BOOST_OS_LINUX || BOOST_OS_MACOS
#include <signal.h>
#include <execinfo.h>
#endif
#if BOOST_OS_WINDOWS
#include <Windows.h>
#include <Dbghelp.h>
#include <shellapi.h>
@ -16,16 +10,11 @@
#include "Cafe/OS/libs/coreinit/coreinit_Thread.h"
#include "Cafe/HW/Espresso/PPCState.h"
#endif
extern uint32 currentBaseApplicationHash;
extern uint32 currentUpdatedApplicationHash;
#if BOOST_OS_WINDOWS
LONG handleException_SINGLE_STEP(PEXCEPTION_POINTERS pExceptionInfo)
{
return EXCEPTION_CONTINUE_SEARCH;
}
@ -416,27 +405,3 @@ void ExceptionHandler_init()
AddVectoredExceptionHandler(1, VectoredExceptionHandler);
SetErrorMode(SEM_FAILCRITICALERRORS);
}
#else
void handler_SIGSEGV(int sig)
{
printf("SIGSEGV!\n");
void *array[32];
size_t size;
// get void*'s for all entries on the stack
size = backtrace(array, 32);
// print out all the frames to stderr
fprintf(stderr, "Error: signal %d:\n", sig);
backtrace_symbols_fd(array, size, STDERR_FILENO);
exit(1);
}
void ExceptionHandler_init()
{
signal(SIGSEGV, handler_SIGSEGV);
}
#endif

View file

@ -399,11 +399,4 @@ void CemuApp::ActivateApp(wxActivateEvent& event)
event.Skip();
}
extern "C"
{
CemuApp& wxGetAppWrapper()
{
return *static_cast<CemuApp*>(wxApp::GetInstance());
};
}

View file

@ -243,7 +243,8 @@ void wxGameList::SetStyle(Style style, bool save)
g_config.Save();
}
ApplyGameListColumnWidths();
if (style == Style::kList)
ApplyGameListColumnWidths();
}
long wxGameList::GetStyleFlags(Style style) const

View file

@ -73,7 +73,8 @@ void SymbolListCtrl::OnGameLoaded()
rplSymbolStorage_unlockSymbolMap();
SetItemCount(m_data.size());
RefreshItems(GetTopItem(), GetTopItem() + GetCountPerPage() + 1);
if (m_data.size() > 0)
RefreshItems(GetTopItem(), std::min<long>(m_data.size() - 1, GetTopItem() + GetCountPerPage() + 1));
}
wxString SymbolListCtrl::OnGetItemText(long item, long column) const
@ -159,5 +160,6 @@ void SymbolListCtrl::ChangeListFilter(std::string filter)
}
}
SetItemCount(visible_entries);
RefreshItems(GetTopItem(), GetTopItem() + GetCountPerPage() + 1);
if (visible_entries > 0)
RefreshItems(GetTopItem(), std::min<long>(visible_entries - 1, GetTopItem() + GetCountPerPage() + 1));
}

View file

@ -372,7 +372,9 @@ void TextureRelationViewerWindow::RefreshTextureList()
}
}
textureRelationListA->Thaw();
textureRelationListA->EnsureVisible(scrollPos + textureRelationListA->GetCountPerPage() - 1);
long itemCount = textureRelationListA->GetItemCount();
if (itemCount > 0)
textureRelationListA->EnsureVisible(std::min<long>(itemCount - 1, scrollPos + textureRelationListA->GetCountPerPage() - 1));
}
void TextureRelationViewerWindow::OnTextureListRightClick(wxMouseEvent& event)