diff --git a/.gitignore b/.gitignore index 42043f3a3e..e63336601e 100644 --- a/.gitignore +++ b/.gitignore @@ -42,6 +42,9 @@ PPSSPPDebug.exe.manifest PPSSPPDebugARM64.exe.manifest PPSSPPDebugARM.exe.manifest assets/flash0 +assets/flash1 +assets/flash2 +assets/flash3 UWP/icph UWP/*.ipch UWP/Content/* @@ -95,6 +98,9 @@ GameLogNotes.txt screenshots android/assets/lang android/assets/flash0 +android/assets/flash1 +android/assets/flash2 +android/assets/flash3 font_atlas.zim.png asciifont_atlas.zim.png ppge_atlas.zim.png diff --git a/Core/CMakeLists.txt b/Core/CMakeLists.txt index 9307aacead..3c902b2ffa 100644 --- a/Core/CMakeLists.txt +++ b/Core/CMakeLists.txt @@ -453,6 +453,8 @@ add_library(Core STATIC HLE/sceAudio.h HLE/sceCcc.h HLE/sceCcc.cpp + HLE/sceChkreg.cpp + HLE/sceChkreg.h HLE/sceChnnlsv.cpp HLE/sceChnnlsv.h HLE/sceCtrl.cpp diff --git a/Core/Core.vcxproj b/Core/Core.vcxproj index 5b8fa83a39..3c7f560423 100644 --- a/Core/Core.vcxproj +++ b/Core/Core.vcxproj @@ -477,6 +477,7 @@ + @@ -1026,6 +1027,7 @@ + @@ -1326,4 +1328,4 @@ - + \ No newline at end of file diff --git a/Core/Core.vcxproj.filters b/Core/Core.vcxproj.filters index f8c593bd94..d6790ae2a7 100644 --- a/Core/Core.vcxproj.filters +++ b/Core/Core.vcxproj.filters @@ -1414,6 +1414,9 @@ Core + + HLE\Libraries + @@ -2301,6 +2304,9 @@ HLE + + HLE\Libraries + diff --git a/Core/HLE/HLE.cpp b/Core/HLE/HLE.cpp index d1341be640..0a57317cd5 100644 --- a/Core/HLE/HLE.cpp +++ b/Core/HLE/HLE.cpp @@ -1224,7 +1224,7 @@ void hleDoLogInternal(Log t, LogLevel level, u64 res, const char *file, int line } const char *kernelFlag = (funcFlags & HLE_KERNEL_SYSCALL) ? "K " : ""; - if (retmask != 'v') { + if (retmask != 'v' && retmask != '?') { if (errStr) { GenericLog(t, level, file, line, fmt, kernelFlag, errStr, funcName, formatted_args, formatted_reason); } else { diff --git a/Core/HLE/HLETables.cpp b/Core/HLE/HLETables.cpp index ac615914cf..373c92236f 100644 --- a/Core/HLE/HLETables.cpp +++ b/Core/HLE/HLETables.cpp @@ -26,6 +26,7 @@ #include "sceCcc.h" #include "sceChnnlsv.h" #include "sceCtrl.h" +#include "sceChkreg.h" #include "sceDeflt.h" #include "sceDisplay.h" #include "sceDmac.h" @@ -313,6 +314,7 @@ void RegisterAllModules() { Register_scePower_driver(); Register_sceImpose_driver(); Register_sceHprm_driver(); + Register_sceChkreg(); // add new modules here. // Not ready to enable this due to apparent softlocks in Patapon 3. diff --git a/Core/HLE/sceAudio.cpp b/Core/HLE/sceAudio.cpp index 072b430872..f9843a0f1a 100644 --- a/Core/HLE/sceAudio.cpp +++ b/Core/HLE/sceAudio.cpp @@ -186,7 +186,8 @@ static int sceAudioGetChannelRestLength(u32 chan) { } static u32 GetFreeChannel() { - for (u32 i = PSP_AUDIO_CHANNEL_MAX - 1; i > 0; --i) { + // Changed this to allow channel 0. Fixes the startup sound in VSH. TODO: Why did we not allow channel 0 before? + for (u32 i = PSP_AUDIO_CHANNEL_MAX - 1; i >= 0; --i) { if (!g_audioChans[i].reserved) return i; } diff --git a/Core/HLE/sceChkreg.cpp b/Core/HLE/sceChkreg.cpp new file mode 100644 index 0000000000..a4611de247 --- /dev/null +++ b/Core/HLE/sceChkreg.cpp @@ -0,0 +1,40 @@ +#include "Core/HLE/HLE.h" +#include "Core/HLE/FunctionWrappers.h" +#include "Core/HLE/sceChkreg.h" + +static int sceChkregCheckRegion(int unknown1, int unknown2) { + // region is correct. + return hleLogWarning(Log::sceMisc, 1); +} + +int sceChkreg_driver_6894A027(u32 unknown1, u32 unknown2) { + if (Memory::IsValid4AlignedAddress(unknown1)) { + Memory::WriteUnchecked_U32(1, unknown1); + } + return hleLogWarning(Log::sceMisc, 0); +} + +int sceChkregGetPspModel() { + // Has no parameters + return hleLogWarning(Log::sceMisc, 1); +} + +int sceChkregGetPsCode(u32 ptr) { + static const u8 values[8] = {1, 0, 5, 0, 1, 0, 1, 0}; + if (Memory::IsValidRange(ptr, 8)) { + Memory::MemcpyUnchecked(ptr, values, 8); + } + + return hleLogWarning(Log::sceMisc, 0); +} + +static const HLEFunction sceChkreg[] = { + {0x54495B19, &WrapI_II, "sceChkregCheckRegion", 'i', "ii" }, + {0x59F8491D, &WrapI_U< sceChkregGetPsCode>, "sceChkregGetPsCode", 'i', "x"}, + {0x6894A027, &WrapI_UU, "sceChkreg_driver_6894A027", 'i', "xx" }, + {0x7939C851, &WrapI_V, "sceChkregGetPspModel", 'i', "" }, +}; + +void Register_sceChkreg() { + RegisterHLEModule("sceChkreg_driver", ARRAY_SIZE(sceChkreg), sceChkreg); +} diff --git a/Core/HLE/sceChkreg.h b/Core/HLE/sceChkreg.h new file mode 100644 index 0000000000..933c1ef255 --- /dev/null +++ b/Core/HLE/sceChkreg.h @@ -0,0 +1,3 @@ +#pragma once + +void Register_sceChkreg(); diff --git a/Core/HLE/sceIo.cpp b/Core/HLE/sceIo.cpp index eb33c71126..16926cbc2d 100644 --- a/Core/HLE/sceIo.cpp +++ b/Core/HLE/sceIo.cpp @@ -1849,6 +1849,9 @@ static u32 sceIoDevctl(const char *name, int cmd, u32 argAddr, int argLen, u32 o return hleLogError(Log::sceIo, -1, "Failed 0x02425824 fat"); } break; + case 0x02425856: + // Used by VSH, no clue what it should do. Let's just return 0. + return hleLogError(Log::sceIo, 0, "Unknown memstick devctl: %08x", cmd); } } diff --git a/Core/HLE/sceKernel.cpp b/Core/HLE/sceKernel.cpp index 6e710a0a21..6d11ce58f6 100644 --- a/Core/HLE/sceKernel.cpp +++ b/Core/HLE/sceKernel.cpp @@ -66,6 +66,7 @@ #include "sceKernelEventFlag.h" #include "sceKernelVTimer.h" #include "sceKernelTime.h" +#include "sceMd5.h" #include "sceMp3.h" #include "sceMpeg.h" #include "sceNet.h" @@ -1016,7 +1017,7 @@ const HLEFunction UtilsForKernel[] = { {0xC2DF770E, WrapI_UI, "sceKernelIcacheInvalidateRange", 'i', "xi", HLE_KERNEL_SYSCALL }, {0X78934841, nullptr, "sceKernelGzipDecompress", '?', "" }, {0XE8DB3CE6, nullptr, "sceKernelDeflateDecompress", '?', "" }, - {0X840259F1, nullptr, "sceKernelUtilsSha1Digest", '?', "" }, + {0X840259F1, &WrapI_UIU, "sceKernelUtilsSha1Digest", '?', "" }, {0X9E5C5086, nullptr, "sceKernelUtilsMd5BlockInit", '?', "" }, {0X61E1E525, nullptr, "sceKernelUtilsMd5BlockUpdate", '?', "" }, {0XB8D24E78, nullptr, "sceKernelUtilsMd5BlockResult", '?', "" }, diff --git a/Core/HLE/sceKernelHeap.cpp b/Core/HLE/sceKernelHeap.cpp index 284a70564d..d2269abdfb 100644 --- a/Core/HLE/sceKernelHeap.cpp +++ b/Core/HLE/sceKernelHeap.cpp @@ -160,6 +160,11 @@ static int sceKernelAllocHeapMemoryWithOption(int heapId, u32 memSize, u32 param return addr; } +static int sceKernelGetModel() { + constexpr u32 model = 2; // 2 = original slim. + return hleLogWarning(Log::sceKernel, model - 1); +} + const HLEFunction SysMemForKernel[] = { { 0X636C953B, &WrapI_II, "sceKernelAllocHeapMemory", 'x', "ii", HLE_KERNEL_SYSCALL }, { 0XC9805775, &WrapI_I, "sceKernelDeleteHeap", 'i', "i" , HLE_KERNEL_SYSCALL }, @@ -173,7 +178,8 @@ const HLEFunction SysMemForKernel[] = { { 0X536AD5E1, &WrapU_V, "sceKernelGetUidmanCB", 'i', "i" , HLE_KERNEL_SYSCALL }, { 0X7B749390, &WrapI_IU, "sceKernelFreeHeapMemory", 'i', "ix" , HLE_KERNEL_SYSCALL }, { 0XEB7A74DB, &WrapI_IUU, "sceKernelAllocHeapMemoryWithOption", 'i', "ixp" , HLE_KERNEL_SYSCALL }, - { 0x6373995d, nullptr, "sceKernelGetModel", 'i', "", HLE_KERNEL_SYSCALL }, + { 0x6373995d, &WrapI_V, "sceKernelGetModel", 'i', "", HLE_KERNEL_SYSCALL}, // 220 + { 0x07C586A1, &WrapI_V, "sceKernelGetModel", 'i', "", HLE_KERNEL_SYSCALL }, // 220 }; void Register_SysMemForKernel() { diff --git a/Core/HLE/sceKernelThread.cpp b/Core/HLE/sceKernelThread.cpp index 33fe155657..7e781ea96e 100644 --- a/Core/HLE/sceKernelThread.cpp +++ b/Core/HLE/sceKernelThread.cpp @@ -1854,7 +1854,12 @@ int __KernelCreateThread(const char *threadName, SceUID moduleID, u32 entry, u32 } if (optionAddr != 0) { - WARN_LOG_REPORT(Log::sceKernel, "sceKernelCreateThread(name=%s): unsupported options parameter %08x", threadName, optionAddr); + if (Memory::IsValid4AlignedAddress(optionAddr)) { + u32 structSize = Memory::ReadUnchecked_U32(optionAddr); + WARN_LOG(Log::sceKernel, "sceKernelCreateThread(name=%s): unsupported options parameter %08x", threadName, optionAddr); + } else { + ERROR_LOG(Log::sceKernel, "sceKernelCreateThread(name=%s): bad options parameter %08x", threadName, optionAddr); + } } // Creating a thread resumes dispatch automatically. Probably can't create without it. diff --git a/Core/HLE/scePower.cpp b/Core/HLE/scePower.cpp index 748647bd3a..e062c648b9 100644 --- a/Core/HLE/scePower.cpp +++ b/Core/HLE/scePower.cpp @@ -204,6 +204,24 @@ static int scePowerIsLowBattery() { return hleLogDebug(Log::HLE, 0); } +static int scePowerIsSuspendRequired() { + return hleLogInfo(Log::HLE, 0); +} + +static int scePowerCancelRequest(u32 something) { + return hleLogError(Log::sceMisc, 0, "UNIMPL"); +} + +static int scePowerRequestSuspend() { + // Don't think we need to do anything. + return hleLogWarning(Log::sceMisc, 0, "UNIMPL"); +} + +static int scePowerRequestStandby() { + // Don't think we need to do anything. + return hleLogWarning(Log::sceMisc, 0, "UNIMPL"); +} + static int scePowerRegisterCallback(int slot, int cbId) { if (slot < -1 || slot >= numberOfCBPowerSlotsPrivate) { return hleLogError(Log::HLE, PSP_POWER_ERROR_INVALID_SLOT); @@ -568,7 +586,7 @@ static const HLEFunction scePower[] = { {0X1E490401, &WrapI_V, "scePowerIsBatteryCharging", 'i', "" }, {0XB4432BC8, &WrapI_V, "scePowerGetBatteryChargingStatus", 'i', "" }, {0XD3075926, &WrapI_V, "scePowerIsLowBattery", 'i', "" }, - {0X78A1A796, nullptr, "scePowerIsSuspendRequired", '?', "" }, + {0X78A1A796, &WrapI_V, "scePowerIsSuspendRequired", '?', "" }, {0X94F5A53F, nullptr, "scePowerGetBatteryRemainCapacity", '?', "" }, {0XFD18A0FF, nullptr, "scePowerGetBatteryFullCapacity", '?', "" }, {0X2085D15D, &WrapI_V, "scePowerGetBatteryLifePercent", 'i', "" }, @@ -582,10 +600,10 @@ static const HLEFunction scePower[] = { {0X165CE085, nullptr, "scePowerGetPowerSwMode", '?', "" }, {0XD6D016EF, nullptr, "scePowerLock", '?', "" }, {0XCA3D34C1, nullptr, "scePowerUnlock", '?', "" }, - {0XDB62C9CF, nullptr, "scePowerCancelRequest", '?', "" }, + {0XDB62C9CF, &WrapI_U, "scePowerCancelRequest", 'i', "" }, {0X7FA406DD, nullptr, "scePowerIsRequest", '?', "" }, - {0X2B7C7CF4, nullptr, "scePowerRequestStandby", '?', "" }, - {0XAC32C9CC, nullptr, "scePowerRequestSuspend", '?', "" }, + {0X2B7C7CF4, &WrapI_V, "scePowerRequestStandby", 'I', "" }, + {0XAC32C9CC, &WrapI_V, "scePowerRequestSuspend", 'I', "" }, {0X2875994B, nullptr, "scePower_2875994B", '?', "" }, {0X0074EF9B, nullptr, "scePowerGetResumeCount", '?', "" }, {0XDFA8BAF8, &WrapI_I, "scePowerUnregisterCallback", 'i', "i" }, diff --git a/Core/HLE/sceRtc.cpp b/Core/HLE/sceRtc.cpp index e4059dda96..8379d12091 100644 --- a/Core/HLE/sceRtc.cpp +++ b/Core/HLE/sceRtc.cpp @@ -941,11 +941,9 @@ static int sceRtcGetLastReincarnatedTime(u32 tickPtr) return 0; } -//Returns 0 on success, according to Project Diva 2nd jpcsptrace log -static int sceRtcSetAlarmTick(u32 unknown1, u32 unknown2) -{ - ERROR_LOG_REPORT(Log::sceRtc, "UNIMPL sceRtcSetAlarmTick(%x, %x)", unknown1, unknown2); - return 0; +// Returns 0 on success, according to Project Diva 2nd jpcsptrace log +static int sceRtcSetAlarmTick(u32 unknown1, u32 unknown2) { + return hleLogError(Log::sceRtc, 0, "UNIMPL"); } // Real signature per uofw (sceRtc_C2DDBEB5, src/kd/rtc/rtc.c): s32 sceRtcGetAlarmTick(u64 *tick). diff --git a/Core/Util/RecentFiles.cpp b/Core/Util/RecentFiles.cpp index 339b125eff..2e4dead9c6 100644 --- a/Core/Util/RecentFiles.cpp +++ b/Core/Util/RecentFiles.cpp @@ -7,6 +7,7 @@ #include "Common/Thread/ThreadUtil.h" #include "Common/Log.h" #include "Common/TimeUtil.h" +#include "Common/StringUtils.h" #include "Core/Loaders.h" #include "Core/Util/RecentFiles.h" #include "Core/Util/PathUtil.h" @@ -129,6 +130,8 @@ void RecentFilesManager::Add(std::string_view filename) { return; } + // Some things should not be added to recent, such as the VSH (which will have a separate UI for launching it) + std::lock_guard guard(cmdLock_); cmds_.push(RecentCommand{ RecentCmd::Add, {}, std::make_unique(filename) }); cmdCondVar_.notify_one(); diff --git a/UWP/CoreUWP/CoreUWP.vcxproj b/UWP/CoreUWP/CoreUWP.vcxproj index fc9adcd92a..e4b1fd7c91 100644 --- a/UWP/CoreUWP/CoreUWP.vcxproj +++ b/UWP/CoreUWP/CoreUWP.vcxproj @@ -161,6 +161,7 @@ + @@ -440,6 +441,7 @@ + diff --git a/UWP/CoreUWP/CoreUWP.vcxproj.filters b/UWP/CoreUWP/CoreUWP.vcxproj.filters index 40dec34a6e..1cc8c3d205 100644 --- a/UWP/CoreUWP/CoreUWP.vcxproj.filters +++ b/UWP/CoreUWP/CoreUWP.vcxproj.filters @@ -419,6 +419,7 @@ + @@ -700,6 +701,7 @@ + diff --git a/android/jni/Android.mk b/android/jni/Android.mk index ddbc8c79f2..654217ce62 100644 --- a/android/jni/Android.mk +++ b/android/jni/Android.mk @@ -709,6 +709,7 @@ EXEC_AND_LIB_FILES := \ $(SRC)/Core/HLE/sceAudiocodec.cpp.arm \ $(SRC)/Core/HLE/sceAudioRouting.cpp \ $(SRC)/Core/HLE/sceChnnlsv.cpp \ + $(SRC)/Core/HLE/sceChkreg.cpp \ $(SRC)/Core/HLE/sceCcc.cpp \ $(SRC)/Core/HLE/sceCtrl.cpp.arm \ $(SRC)/Core/HLE/sceDeflt.cpp \ diff --git a/libretro/Makefile.common b/libretro/Makefile.common index 9a83bd6c8c..fdf991d907 100644 --- a/libretro/Makefile.common +++ b/libretro/Makefile.common @@ -770,6 +770,7 @@ SOURCES_CXX += \ $(COREDIR)/HLE/sceAudiocodec.cpp \ $(COREDIR)/HLE/sceAudioRouting.cpp \ $(COREDIR)/HLE/sceCcc.cpp \ + $(COREDIR)/HLE/sceChkreg.cpp \ $(COREDIR)/HLE/sceChnnlsv.cpp \ $(COREDIR)/HLE/sceCtrl.cpp \ $(COREDIR)/HLE/sceDeflt.cpp \