one step closer to run games

This commit is contained in:
InoriRus
2022-04-27 18:49:15 +10:00
parent 08b0a87225
commit bc02c0560e
47 changed files with 3020 additions and 1108 deletions
+29
View File
@@ -23,6 +23,20 @@ LIB_DEFINE(InitAudio_1_AudioOut)
} // namespace LibAudioOut
namespace LibAudioIn {
LIB_VERSION("AudioIn", 1, "AudioIn", 1, 1);
namespace AudioIn = Audio::AudioIn;
LIB_DEFINE(InitAudio_1_AudioIn)
{
LIB_FUNC("5NE8Sjc7VC8", AudioIn::AudioInOpen);
LIB_FUNC("LozEOU8+anM", AudioIn::AudioInInput);
}
} // namespace LibAudioIn
namespace LibVoiceQoS {
LIB_VERSION("VoiceQoS", 1, "VoiceQoS", 0, 0);
@@ -36,10 +50,25 @@ LIB_DEFINE(InitAudio_1_VoiceQoS)
} // namespace LibVoiceQoS
namespace LibAjm {
LIB_VERSION("Ajm", 1, "Ajm", 1, 1);
namespace Ajm = Audio::Ajm;
LIB_DEFINE(InitAudio_1_Ajm)
{
LIB_FUNC("dl+4eHSzUu4", Ajm::AjmInitialize);
}
} // namespace LibAjm
LIB_DEFINE(InitAudio_1)
{
LibAudioOut::InitAudio_1_AudioOut(s);
LibAudioIn::InitAudio_1_AudioIn(s);
LibVoiceQoS::InitAudio_1_VoiceQoS(s);
LibAjm::InitAudio_1_Ajm(s);
}
} // namespace Kyty::Libs
+16
View File
@@ -20,9 +20,25 @@ LIB_DEFINE(InitDialog_1_CommonDialog)
} // namespace LibCommonDialog
namespace LibSaveDataDialog {
LIB_VERSION("SaveDataDialog", 1, "SaveDataDialog", 1, 1);
namespace SaveDataDialog = Dialog::SaveDataDialog;
LIB_DEFINE(InitDialog_1_SaveDataDialog)
{
LIB_FUNC("KK3Bdg1RWK0", SaveDataDialog::SaveDataDialogUpdateStatus);
LIB_FUNC("YuH2FA7azqQ", SaveDataDialog::SaveDataDialogTerminate);
LIB_FUNC("hay1CfTmLyA", SaveDataDialog::SaveDataDialogProgressBarSetValue);
}
} // namespace LibSaveDataDialog
LIB_DEFINE(InitDialog_1)
{
LibCommonDialog::InitDialog_1_CommonDialog(s);
LibSaveDataDialog::InitDialog_1_SaveDataDialog(s);
}
} // namespace Kyty::Libs
@@ -18,6 +18,7 @@ LIB_DEFINE(InitGraphicsDriver_1)
LIB_FUNC("bQVd5YzCal0", Graphics::GraphicsSetPsShader);
LIB_FUNC("5uFKckiJYRM", Graphics::GraphicsSetPsShader350);
LIB_FUNC("4MgRw-bVNQU", Graphics::GraphicsUpdatePsShader);
LIB_FUNC("mLVL7N7BVBg", Graphics::GraphicsUpdatePsShader350);
LIB_FUNC("Kx-h-nWQJ8A", Graphics::GraphicsSetCsShaderWithModifier);
LIB_FUNC("HlTPoZ-oY7Y", Graphics::GraphicsDrawIndex);
LIB_FUNC("GGsn7jMTxw4", Graphics::GraphicsDrawIndexAuto);
+15
View File
@@ -437,11 +437,21 @@ int KYTY_SYSV_ABI nanosleep(const LibKernel::KernelTimespec* rqtp, LibKernel::Ke
return POSIX_CALL(LibKernel::KernelNanosleep(rqtp, rmtp));
}
int KYTY_SYSV_ABI stat(const char* path, LibKernel::FileSystem::FileStat* sb)
{
PRINT_NAME();
return POSIX_CALL(LibKernel::FileSystem::KernelStat(path, sb));
}
LIB_DEFINE(InitLibKernel_1_Posix)
{
LIB_FUNC("lLMT9vJAck0", clock_gettime);
LIB_FUNC("yS8U2TGCe1A", nanosleep);
LIB_FUNC("E6ao34wPw+U", stat);
LIB_FUNC("OxhIB8LB-PQ", Posix::pthread_create);
LIB_FUNC("h9CcP3J0oVM", Posix::pthread_join);
LIB_FUNC("7H0iTOciTLo", Posix::pthread_mutex_lock);
LIB_FUNC("2Z+PpY6CaJg", Posix::pthread_mutex_unlock);
LIB_FUNC("ttHNfU+qDBU", Posix::pthread_mutex_init);
@@ -474,6 +484,8 @@ LIB_DEFINE(InitLibKernel_1_FS)
LIB_FUNC("AUXVxWeJU-A", FileSystem::KernelUnlink);
LIB_FUNC("taRWhTJFTgE", FileSystem::KernelGetdirentries);
LIB_FUNC("oib76F-12fk", FileSystem::KernelLseek);
LIB_FUNC("j2AIqSqJP0w", FileSystem::KernelGetdents);
LIB_FUNC("1-LFLmRFxxM", FileSystem::KernelMkdir);
}
LIB_DEFINE(InitLibKernel_1_Mem)
@@ -531,6 +543,7 @@ LIB_DEFINE(InitLibKernel_1_Pthread)
LIB_FUNC("bt3CTBKmGyI", LibKernel::PthreadSetaffinity);
LIB_FUNC("1tKyG7RlMJo", LibKernel::PthreadGetprio);
LIB_FUNC("W0Hpm2X0uPE", LibKernel::PthreadSetprio);
LIB_FUNC("T72hz6ffq08", LibKernel::PthreadYield);
LIB_FUNC("62KCwEMmzcM", LibKernel::PthreadAttrDestroy);
LIB_FUNC("x1X76arYMxU", LibKernel::PthreadAttrGet);
@@ -557,8 +570,10 @@ LIB_DEFINE(InitLibKernel_1_Pthread)
LIB_FUNC("g+PZd2hiacg", LibKernel::PthreadCondDestroy);
LIB_FUNC("WKAXJ4XBPQ4", LibKernel::PthreadCondWait);
LIB_FUNC("JGgj7Uvrl+A", LibKernel::PthreadCondBroadcast);
LIB_FUNC("kDh-NfxgMtE", LibKernel::PthreadCondSignal);
LIB_FUNC("BmMjYxmew1w", LibKernel::PthreadCondTimedwait);
LIB_FUNC("m5-2bsNfv7s", LibKernel::PthreadCondattrInit);
LIB_FUNC("waPcxYiR3WA", LibKernel::PthreadCondattrDestroy);
LIB_FUNC("QBi7HCK03hw", LibKernel::KernelClockGettime);
LIB_FUNC("ejekcaNQNq0", LibKernel::KernelGettimeofday);
+24
View File
@@ -97,6 +97,19 @@ LIB_DEFINE(InitNet_1_Http)
{
LIB_FUNC("A9cVMUtEp4Y", Http::HttpInit);
LIB_FUNC("0gYjPTR-6cY", Http::HttpCreateTemplate);
LIB_FUNC("4I8vEpuEhZ8", Http::HttpDeleteTemplate);
LIB_FUNC("s2-NPIvz+iA", Http::HttpSetNonblock);
LIB_FUNC("htyBOoWeS58", Http::HttpsSetSslCallback);
LIB_FUNC("6381dWF+xsQ", Http::HttpCreateEpoll);
LIB_FUNC("wYhXVfS2Et4", Http::HttpDestroyEpoll);
LIB_FUNC("-xm7kZQNpHI", Http::HttpSetEpoll);
LIB_FUNC("59tL1AQBb8U", Http::HttpUnsetEpoll);
LIB_FUNC("qgxDBjorUxs", Http::HttpCreateConnectionWithURL);
LIB_FUNC("P6A3ytpsiYc", Http::HttpDeleteConnection);
LIB_FUNC("Cnp77podkCU", Http::HttpCreateRequestWithURL2);
LIB_FUNC("qe7oZ+v4PWA", Http::HttpDeleteRequest);
LIB_FUNC("EY28T2bkN7k", Http::HttpAddRequestHeader);
LIB_FUNC("1e2BNwI-XzE", Http::HttpSendRequest);
}
} // namespace LibHttp
@@ -133,6 +146,13 @@ LIB_DEFINE(InitNet_1_NpManager)
LIB_FUNC("VfRSmPmj8Q8", NpManager::NpRegisterStateCallback);
LIB_FUNC("uFJpaKNBAj4", NpManager::NpRegisterGamePresenceCallback);
LIB_FUNC("GImICnh+boA", NpManager::NpRegisterPlusEventCallback);
LIB_FUNC("p-o74CnoNzY", NpManager::NpGetNpId);
LIB_FUNC("XDncXQIJUSk", NpManager::NpGetOnlineId);
LIB_FUNC("eiqMCt9UshI", NpManager::NpCreateAsyncRequest);
LIB_FUNC("S7QTn72PrDw", NpManager::NpDeleteRequest);
LIB_FUNC("2rsFmlGWleQ", NpManager::NpCheckNpAvailability);
LIB_FUNC("uqcPJLWL08M", NpManager::NpPollAsync);
LIB_FUNC("eQH7nWPcAgc", NpManager::NpGetState);
}
} // namespace LibNpManager
@@ -146,6 +166,7 @@ namespace NpManagerForToolkit = Network::NpManagerForToolkit;
LIB_DEFINE(InitNet_1_NpManagerForToolkit)
{
LIB_FUNC("0c7HbXRKUt4", NpManagerForToolkit::NpRegisterStateCallbackForToolkit);
LIB_FUNC("JELHf4xPufo", NpManagerForToolkit::NpCheckCallbackForLib);
}
} // namespace LibNpManagerForToolkit
@@ -159,6 +180,9 @@ namespace NpTrophy = Network::NpTrophy;
LIB_DEFINE(InitNet_1_NpTrophy)
{
LIB_FUNC("q7U6tEAQf7c", NpTrophy::NpTrophyCreateHandle);
LIB_FUNC("XbkjbobZlCY", NpTrophy::NpTrophyCreateContext);
LIB_FUNC("TJCAxto9SEU", NpTrophy::NpTrophyRegisterContext);
LIB_FUNC("GNcF4oidY0Y", NpTrophy::NpTrophyDestroyHandle);
}
} // namespace LibNpTrophy
+2
View File
@@ -18,6 +18,8 @@ LIB_DEFINE(InitPad_1)
LIB_FUNC("clVvL4ZDntw", Controller::PadSetMotionSensorState);
LIB_FUNC("gjP9-KQzoUk", Controller::PadGetControllerInformation);
LIB_FUNC("YndgXqQVV7c", Controller::PadReadState);
LIB_FUNC("q1cHNfGycLI", Controller::PadRead);
LIB_FUNC("yFVnOdGxvZY", Controller::PadSetVibration);
}
} // namespace Kyty::Libs
+97 -6
View File
@@ -1,8 +1,10 @@
#include "Kyty/Core/Common.h"
#include "Kyty/Core/DbgAssert.h"
#include "Kyty/Core/File.h"
#include "Kyty/Core/String.h"
#include "Emulator/Common.h"
#include "Emulator/Kernel/FileSystem.h"
#include "Emulator/Libs/Errno.h"
#include "Emulator/Libs/Libs.h"
#include "Emulator/SymbolDatabase.h"
@@ -15,6 +17,10 @@ LIB_VERSION("SaveData", 1, "SaveData", 1, 1);
namespace SaveData {
// TODO(): specify dir at launcher
static constexpr char32_t SAVE_DATA_DIR[] = U"_SaveData";
static constexpr char32_t SAVE_DATA_POINT[] = U"/savedata0";
struct SceSaveDataDirName
{
char data[32];
@@ -46,6 +52,17 @@ struct SaveDataMountResult
int pad;
};
struct SaveDataParam
{
char title[128];
char sub_title[128];
char detail[1024];
uint32_t user_param;
int pad;
int64_t mtime;
uint8_t reserved[32];
};
int KYTY_SYSV_ABI SaveDataInitialize(const void* /*init*/)
{
PRINT_NAME();
@@ -85,18 +102,90 @@ int KYTY_SYSV_ABI SaveDataMount2(const SaveDataMount2* mount, SaveDataMountResul
printf("\t blocks = %" PRIu64 "\n", mount->blocks);
printf("\t mount_mode = %" PRIu32 "\n", mount->mount_mode);
if (mount->mount_mode == 1)
{
return SAVE_DATA_ERROR_NOT_FOUND;
} else // NOLINT
String mount_dir = String(SAVE_DATA_DIR) + U"/" + String::FromUtf8(mount->dir_name->data);
String mount_point = SAVE_DATA_POINT;
bool create = (mount->mount_mode == 22);
bool open = (mount->mount_mode == 1 || mount->mount_mode == 2);
if (!create && !open)
{
EXIT("unknown mount mode: %u", mount->mount_mode);
}
strcpy(mount_result->mount_point.data, "/savedata0");
if (open)
{
EXIT_NOT_IMPLEMENTED(create);
if (!Core::File::IsDirectoryExisting(mount_dir))
{
return SAVE_DATA_ERROR_NOT_FOUND;
}
LibKernel::FileSystem::Mount(mount_dir, mount_point);
mount_result->mount_status = 0;
}
if (create)
{
EXIT_NOT_IMPLEMENTED(open);
if (Core::File::IsDirectoryExisting(mount_dir))
{
return SAVE_DATA_ERROR_EXISTS;
}
Core::File::CreateDirectories(mount_dir);
EXIT_NOT_IMPLEMENTED((!Core::File::IsDirectoryExisting(mount_dir)));
LibKernel::FileSystem::Mount(mount_dir, mount_point);
mount_result->mount_status = 1;
}
snprintf(mount_result->mount_point.data, 16, "%s", mount_point.C_Str());
mount_result->required_blocks = 0;
mount_result->mount_status = 1;
return OK;
}
int KYTY_SYSV_ABI SaveDataUmount(const SaveDataMountPoint* mount_point)
{
PRINT_NAME();
EXIT_NOT_IMPLEMENTED(mount_point == nullptr);
printf("\t mount_point = %s\n", mount_point->data);
LibKernel::FileSystem::Umount(String::FromUtf8(mount_point->data));
return OK;
}
int KYTY_SYSV_ABI SaveDataSetParam(const SaveDataMountPoint* mount_point, uint32_t param_type, const void* param_buf, size_t param_buf_size)
{
PRINT_NAME();
EXIT_NOT_IMPLEMENTED(mount_point == nullptr);
printf("\t mount_point = %s\n", mount_point->data);
printf("\t param_type = %u\n", param_type);
printf("\t param_buf_size = %" PRIu64 "\n", param_buf_size);
if (param_type == 0)
{
const auto* p = static_cast<const SaveDataParam*>(param_buf);
printf("\t title = %s\n", p->title);
printf("\t sub_title = %s\n", p->sub_title);
printf("\t detail = %s\n", p->detail);
printf("\t user_param = %u\n", p->user_param);
} else
{
KYTY_NOT_IMPLEMENTED;
}
return OK;
}
@@ -109,6 +198,8 @@ LIB_DEFINE(InitSaveData_1)
LIB_FUNC("l1NmDeDpNGU", SaveData::SaveDataInitialize2);
LIB_FUNC("TywrFKCoLGY", SaveData::SaveDataInitialize3);
LIB_FUNC("0z45PIH+SNI", SaveData::SaveDataMount2);
LIB_FUNC("BMR4F-Uek3E", SaveData::SaveDataUmount);
LIB_FUNC("85zul--eGXs", SaveData::SaveDataSetParam);
}
} // namespace Kyty::Libs
@@ -90,6 +90,12 @@ struct SystemServiceStatus
bool is_out_of_vr_play_area = false;
};
struct SystemServiceDisplaySafeAreaInfo
{
float ratio;
uint8_t reserved[128];
};
static int KYTY_SYSV_ABI SystemServiceHideSplashScreen()
{
PRINT_NAME();
@@ -141,6 +147,20 @@ static int KYTY_SYSV_ABI SystemServiceGetStatus(SystemServiceStatus* status)
return OK;
}
static int KYTY_SYSV_ABI SystemServiceGetDisplaySafeAreaInfo(SystemServiceDisplaySafeAreaInfo* info)
{
PRINT_NAME();
if (info == nullptr)
{
return SYSTEM_SERVICE_ERROR_PARAMETER;
}
info->ratio = 1.0f;
return OK;
}
} // namespace SystemService
LIB_DEFINE(InitSystemService_1)
@@ -148,6 +168,7 @@ LIB_DEFINE(InitSystemService_1)
LIB_FUNC("Vo5V8KAwCmk", SystemService::SystemServiceHideSplashScreen);
LIB_FUNC("fZo48un7LK4", SystemService::SystemServiceParamGetInt);
LIB_FUNC("rPo6tV8D9bM", SystemService::SystemServiceGetStatus);
LIB_FUNC("1n37q1Bvc5Y", SystemService::SystemServiceGetDisplaySafeAreaInfo);
}
} // namespace Kyty::Libs
@@ -6,6 +6,8 @@
#include "Emulator/Libs/Libs.h"
#include "Emulator/SymbolDatabase.h"
#include <cstdio>
#ifdef KYTY_EMU_ENABLED
namespace Kyty::Libs {
@@ -60,6 +62,16 @@ static KYTY_SYSV_ABI int UserServiceGetLoginUserIdList(UserServiceLoginUserIdLis
return OK;
}
static KYTY_SYSV_ABI int UserServiceGetUserName(int user_id, char* name, size_t size)
{
EXIT_NOT_IMPLEMENTED(user_id != 1);
EXIT_NOT_IMPLEMENTED(size < 5);
snprintf(name, size, "%s", "Kyty");
return OK;
}
} // namespace UserService
LIB_DEFINE(InitUserService_1)
@@ -68,6 +80,7 @@ LIB_DEFINE(InitUserService_1)
LIB_FUNC("CdWp0oHWGr0", UserService::UserServiceGetInitialUser);
LIB_FUNC("yH17Q6NWtVg", UserService::UserServiceGetEvent);
LIB_FUNC("fPhymKNvK-A", UserService::UserServiceGetLoginUserIdList);
LIB_FUNC("1xxcMiGu2fo", UserService::UserServiceGetUserName);
}
} // namespace Kyty::Libs