From 41db5c46a5e631bb127004579a61ee1254c44d36 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 23 Dec 2012 22:47:52 -0800 Subject: [PATCH] Fix random modules not reseting on shutdown. --- Core/HLE/sceImpose.cpp | 5 +++++ Core/HLE/sceImpose.h | 1 + Core/HLE/sceIo.cpp | 6 +++++- Core/HLE/sceKernel.cpp | 4 ++++ Core/HLE/scePower.cpp | 7 +++---- Core/HLE/sceUsb.cpp | 5 +++++ Core/HLE/sceUsb.h | 2 ++ Core/HLE/sceUtility.cpp | 5 +++++ 8 files changed, 30 insertions(+), 5 deletions(-) diff --git a/Core/HLE/sceImpose.cpp b/Core/HLE/sceImpose.cpp index 93a417a088..4122d1e40b 100644 --- a/Core/HLE/sceImpose.cpp +++ b/Core/HLE/sceImpose.cpp @@ -36,6 +36,11 @@ const int PSP_LANGUAGE_SIMPLIFIED_CHINESE = 11; static u32 iLanguage = PSP_LANGUAGE_ENGLISH; static u32 iButtonValue = 0; +void __ImposeInit() +{ + iLanguage = PSP_LANGUAGE_ENGLISH; + iButtonValue = 0; +} u32 sceImposeGetBatteryIconStatus(u32 chargingPtr, u32 iconStatusPtr) { diff --git a/Core/HLE/sceImpose.h b/Core/HLE/sceImpose.h index 1de2aea93e..86eabedcec 100644 --- a/Core/HLE/sceImpose.h +++ b/Core/HLE/sceImpose.h @@ -18,3 +18,4 @@ #pragma once void Register_sceImpose(); +void __ImposeInit(); diff --git a/Core/HLE/sceIo.cpp b/Core/HLE/sceIo.cpp index 941d3a63ef..9f03b26d17 100644 --- a/Core/HLE/sceIo.cpp +++ b/Core/HLE/sceIo.cpp @@ -84,7 +84,7 @@ const std::string &EmuDebugOutput() { typedef u32 (*DeferredAction)(SceUID id, int param); DeferredAction defAction = 0; -u32 defParam; +u32 defParam = 0; #define SCE_STM_FDIR 0x1000 #define SCE_STM_FREG 0x2000 @@ -154,6 +154,8 @@ public: void __IoInit() { INFO_LOG(HLE, "Starting up I/O..."); + MemoryStick_SetFatState(PSP_FAT_MEMORYSTICK_STATE_ASSIGNED); + #ifdef _WIN32 char path_buffer[_MAX_PATH], drive[_MAX_DRIVE] ,dir[_MAX_DIR], file[_MAX_FNAME], ext[_MAX_EXT]; @@ -192,6 +194,8 @@ void __IoInit() { } void __IoShutdown() { + defAction = 0; + defParam = 0; } u32 sceIoAssign(const char *aliasname, const char *physname, const char *devname, u32 flag) { diff --git a/Core/HLE/sceKernel.cpp b/Core/HLE/sceKernel.cpp index 92b0c192f1..713c4090ba 100644 --- a/Core/HLE/sceKernel.cpp +++ b/Core/HLE/sceKernel.cpp @@ -53,6 +53,8 @@ #include "sceUmd.h" #include "sceSsl.h" #include "sceSas.h" +#include "sceImpose.h" +#include "sceUsb.h" #include "../Util/PPGeDraw.h" @@ -93,6 +95,8 @@ void __KernelInit() __UmdInit(); __CtrlInit(); __SslInit(); + __ImposeInit(); + __UsbInit(); // "Internal" PSP libraries __PPGeInit(); diff --git a/Core/HLE/scePower.cpp b/Core/HLE/scePower.cpp index bfe1943bc1..c6b0fecb7d 100644 --- a/Core/HLE/scePower.cpp +++ b/Core/HLE/scePower.cpp @@ -22,16 +22,15 @@ #include "scePower.h" #include "sceKernelThread.h" -static bool volatileMemLocked; - const int POWER_CB_AUTO = -1; - const int numberOfCBPowerSlots = 16; -static int powerCbSlots[numberOfCBPowerSlots]; +static bool volatileMemLocked; +static int powerCbSlots[numberOfCBPowerSlots]; void __PowerInit() { memset(powerCbSlots, 0, sizeof(powerCbSlots)); + volatileMemLocked = false; } int scePowerGetBatteryLifePercent() { diff --git a/Core/HLE/sceUsb.cpp b/Core/HLE/sceUsb.cpp index faec5397a9..1d1ebc2189 100644 --- a/Core/HLE/sceUsb.cpp +++ b/Core/HLE/sceUsb.cpp @@ -22,6 +22,11 @@ bool usbActivated = false; +void __UsbInit() +{ + usbActivated = false; +} + u32 sceUsbActivate() { ERROR_LOG(HLE, "UNIMPL sceUsbActivate"); usbActivated = true; diff --git a/Core/HLE/sceUsb.h b/Core/HLE/sceUsb.h index 009f44ec96..d521a0a9da 100644 --- a/Core/HLE/sceUsb.h +++ b/Core/HLE/sceUsb.h @@ -18,3 +18,5 @@ #pragma once void Register_sceUsb(); + +void __UsbInit(); diff --git a/Core/HLE/sceUtility.cpp b/Core/HLE/sceUtility.cpp index 3155748cf3..f686d722de 100644 --- a/Core/HLE/sceUtility.cpp +++ b/Core/HLE/sceUtility.cpp @@ -36,6 +36,11 @@ PSPPlaceholderDialog netDialog; void __UtilityInit() { + saveDialog.Shutdown(); + msgDialog.Shutdown(); + oskDialog.Shutdown(); + netDialog.Shutdown(); + SavedataParam::Init(); }