mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-21 18:29:05 +02:00
Convert more code
This commit is contained in:
1 parent
67e97c20fb
commit
42a2dfbbc1
5 files changed
+31
-51
No files matched your search
+21
-30
@@ -1061,7 +1061,7 @@ int NetApctl_Term() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sceNetApctlTerm() {
|
||||
static int sceNetApctlTerm() {
|
||||
int retval = NetApctl_Term();
|
||||
hleEatMicro(adhocDefaultDelay);
|
||||
return hleLogSuccessInfoI(Log::sceNet, retval);
|
||||
@@ -1201,7 +1201,7 @@ static int sceNetApctlGetInfo(int code, u32 pInfoAddr) {
|
||||
return hleLogSuccessI(Log::sceNet, 0);
|
||||
}
|
||||
|
||||
int NetApctl_AddHandler(u32 handlerPtr, u32 handlerArg) {
|
||||
static int NetApctl_AddHandler(u32 handlerPtr, u32 handlerArg) {
|
||||
bool foundHandler = false;
|
||||
u32 retval = 0;
|
||||
struct ApctlHandler handler;
|
||||
@@ -1244,15 +1244,15 @@ static u32 sceNetApctlAddHandler(u32 handlerPtr, u32 handlerArg) {
|
||||
return NetApctl_AddHandler(handlerPtr, handlerArg);
|
||||
}
|
||||
|
||||
int NetApctl_DelHandler(u32 handlerID) {
|
||||
if (apctlHandlers.find(handlerID) != apctlHandlers.end()) {
|
||||
apctlHandlers.erase(handlerID);
|
||||
WARN_LOG(Log::sceNet, "Deleted Apctl handler: %d", handlerID);
|
||||
// This one logs like a syscall because it's called at the end of some.
|
||||
static int NetApctl_DelHandler(u32 handlerID) {
|
||||
auto iter = apctlHandlers.find(handlerID);
|
||||
if (iter != apctlHandlers.end()) {
|
||||
apctlHandlers.erase(iter);
|
||||
return hleLogSuccessInfoI(Log::sceNet, 0, "Deleted Apctl handler: %d", handlerID);
|
||||
} else {
|
||||
return hleLogError(Log::sceNet, -1, "Invalid Apctl handler: %d", handlerID);
|
||||
}
|
||||
else {
|
||||
ERROR_LOG(Log::sceNet, "Invalid Apctl handler: %d", handlerID);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int sceNetApctlDelHandler(u32 handlerID) {
|
||||
@@ -1261,7 +1261,6 @@ static int sceNetApctlDelHandler(u32 handlerID) {
|
||||
}
|
||||
|
||||
int sceNetApctlConnect(int confId) {
|
||||
WARN_LOG(Log::sceNet, "sceNetApctlConnect(%i)", confId);
|
||||
if (!g_Config.bEnableWlan)
|
||||
return hleLogError(Log::sceNet, ERROR_NET_APCTL_WLAN_SWITCH_OFF, "apctl wlan off");
|
||||
|
||||
@@ -1277,11 +1276,10 @@ int sceNetApctlConnect(int confId) {
|
||||
__UpdateApctlHandlers(0, PSP_NET_APCTL_STATE_JOINING, PSP_NET_APCTL_EVENT_CONNECT_REQUEST, 0);
|
||||
//hleDelayResult(0, "give time to init/cleanup", adhocEventDelayMS * 1000);
|
||||
// TODO: Blocks current thread and wait for a state change to prevent user-triggered connection attempt from causing events to piles up
|
||||
return hleLogDebug(Log::sceNet, 0, "connect = %i", ret);
|
||||
return hleLogSuccessInfoI(Log::sceNet, 0, "connect = %i", ret);
|
||||
}
|
||||
|
||||
int sceNetApctlDisconnect() {
|
||||
WARN_LOG(Log::sceNet, "UNTESTED %s()", __FUNCTION__);
|
||||
// Like its 'sister' function sceNetAdhocctlDisconnect, we need to alert Apctl handlers that a disconnect took place
|
||||
// or else games like Phantasy Star Portable 2 will hang at certain points (e.g. returning to the main menu after trying to connect to PSN).
|
||||
// Note: Since we're borrowing AdhocServer for Grouping purpose, we should disconnect too
|
||||
@@ -1291,7 +1289,7 @@ int sceNetApctlDisconnect() {
|
||||
apctlEvents.clear();
|
||||
__UpdateApctlHandlers(netApctlState, PSP_NET_APCTL_STATE_DISCONNECTED, PSP_NET_APCTL_EVENT_DISCONNECT_REQUEST, 0);
|
||||
// TODO: Blocks current thread and wait for a state change, but the state should probably need to be changed within 1 frame-time (~16ms)
|
||||
return 0;
|
||||
return hleLogSuccessInfoI(Log::sceNet, 0);
|
||||
}
|
||||
|
||||
int NetApctl_GetState() {
|
||||
@@ -1312,6 +1310,7 @@ static int sceNetApctlGetState(u32 pStateAddr) {
|
||||
return hleLogError(Log::sceNet, -1, "apctl invalid arg"); // 0x8002013A or ERROR_NET_WLAN_INVALID_ARG ?
|
||||
}
|
||||
|
||||
// This one logs like a syscall because it's called at the end of some.
|
||||
int NetApctl_ScanUser() {
|
||||
if (!g_Config.bEnableWlan)
|
||||
return hleLogError(Log::sceNet, ERROR_NET_APCTL_WLAN_SWITCH_OFF, "apctl wlan off");
|
||||
@@ -1321,7 +1320,7 @@ int NetApctl_ScanUser() {
|
||||
return hleLogError(Log::sceNet, ERROR_NET_APCTL_NOT_DISCONNECTED, "apctl not disconnected");
|
||||
|
||||
__UpdateApctlHandlers(0, PSP_NET_APCTL_STATE_SCANNING, PSP_NET_APCTL_EVENT_SCAN_REQUEST, 0);
|
||||
return 0;
|
||||
return hleLogSuccessInfoX(Log::sceNet, 0);
|
||||
}
|
||||
|
||||
static int sceNetApctlScanUser() {
|
||||
@@ -1329,6 +1328,7 @@ static int sceNetApctlScanUser() {
|
||||
return NetApctl_ScanUser();
|
||||
}
|
||||
|
||||
// This one logs like a syscall because it's called at the end of some.
|
||||
int NetApctl_GetBSSDescIDListUser(u32 sizeAddr, u32 bufAddr) {
|
||||
const int userInfoSize = 8; // 8 bytes per entry (next address + entry id)
|
||||
// Faking 4 entries, games like MGS:PW Recruit will need to have a different AP for each entry
|
||||
@@ -1363,11 +1363,10 @@ int NetApctl_GetBSSDescIDListUser(u32 sizeAddr, u32 bufAddr) {
|
||||
Memory::Write_U32(0, bufAddr + offset - userInfoSize);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return hleLogSuccessInfoI(Log::sceNet, 0);
|
||||
}
|
||||
|
||||
static int sceNetApctlGetBSSDescIDListUser(u32 sizeAddr, u32 bufAddr) {
|
||||
WARN_LOG(Log::sceNet, "UNTESTED %s(%08x, %08x)", __FUNCTION__, sizeAddr, bufAddr);
|
||||
return NetApctl_GetBSSDescIDListUser(sizeAddr, bufAddr);
|
||||
}
|
||||
|
||||
@@ -1444,7 +1443,6 @@ static int sceNetApctlGetBSSDescEntryUser(int entryId, int infoId, u32 resultAdd
|
||||
}
|
||||
|
||||
static int sceNetApctlScanSSID2() {
|
||||
WARN_LOG(Log::sceNet, "UNTESTED %s() at %08x", __FUNCTION__, currentMIPS->pc);
|
||||
return NetApctl_ScanUser();
|
||||
}
|
||||
|
||||
@@ -1455,7 +1453,6 @@ static int sceNetApctlScanSSID2() {
|
||||
* Arg4 = input flag? (initially 0/1 ?)
|
||||
***************/
|
||||
static int sceNetApctlGetBSSDescIDList2(u32 Arg1, u32 Arg2, u32 Arg3, u32 Arg4) {
|
||||
WARN_LOG(Log::sceNet, "UNTESTED %s(%08x, %08x, %08x, %08x) at %08x", __FUNCTION__, Arg1, Arg2, Arg3, Arg4, currentMIPS->pc);
|
||||
return NetApctl_GetBSSDescIDListUser(Arg1, Arg2);
|
||||
}
|
||||
|
||||
@@ -1503,7 +1500,6 @@ static int sceNetApctl_lib2_4C19731F(int code, u32 pInfoAddr) {
|
||||
}
|
||||
|
||||
static int sceNetApctlScan() {
|
||||
ERROR_LOG(Log::sceNet, "UNIMPL %s()", __FUNCTION__);
|
||||
return NetApctl_ScanUser();
|
||||
}
|
||||
|
||||
@@ -1523,28 +1519,23 @@ static int sceNetApctl_lib2_C20A144C(int connIndex, u32 ps3MacAddressPtr) {
|
||||
}
|
||||
|
||||
static int sceNetUpnpInit(int unknown1,int unknown2) {
|
||||
ERROR_LOG_REPORT_ONCE(sceNetUpnpInit, Log::sceNet, "UNIMPL sceNetUpnpInit %d,%d",unknown1,unknown2);
|
||||
return 0;
|
||||
return hleLogError(Log::sceNet, 0, "UNIMPL");
|
||||
}
|
||||
|
||||
static int sceNetUpnpStart() {
|
||||
ERROR_LOG(Log::sceNet, "UNIMPL sceNetUpnpStart");
|
||||
return 0;
|
||||
return hleLogError(Log::sceNet, 0, "UNIMPL");
|
||||
}
|
||||
|
||||
static int sceNetUpnpStop() {
|
||||
ERROR_LOG(Log::sceNet, "UNIMPL sceNetUpnpStop");
|
||||
return 0;
|
||||
return hleLogError(Log::sceNet, 0, "UNIMPL");
|
||||
}
|
||||
|
||||
static int sceNetUpnpTerm() {
|
||||
ERROR_LOG(Log::sceNet, "UNIMPL sceNetUpnpTerm");
|
||||
return 0;
|
||||
return hleLogError(Log::sceNet, 0, "UNIMPL");
|
||||
}
|
||||
|
||||
static int sceNetUpnpGetNatInfo() {
|
||||
ERROR_LOG(Log::sceNet, "UNIMPL sceNetUpnpGetNatInfo");
|
||||
return 0;
|
||||
return hleLogError(Log::sceNet, 0, "UNIMPL");
|
||||
}
|
||||
|
||||
static int sceNetGetDropRate(u32 dropRateAddr, u32 dropDurationAddr) {
|
||||
|
||||
@@ -128,7 +128,6 @@ void __NetDoState(PointerWrap &p);
|
||||
int NetApctl_GetState();
|
||||
|
||||
int sceNetApctlConnect(int connIndex);
|
||||
int sceNetApctlTerm();
|
||||
|
||||
// These return false if allowed to be consistent with the similar function for achievements.
|
||||
bool NetworkWarnUserIfOnlineAndCantSavestate();
|
||||
|
||||
@@ -131,5 +131,4 @@ int NetApctl_GetState();
|
||||
|
||||
int sceNetApctlConnect(int connIndex);
|
||||
int sceNetInetPoll(u32 fdsPtr, u32 nfds, int timeout);
|
||||
int sceNetApctlTerm();
|
||||
int sceNetApctlDisconnect();
|
||||
+8
-15
@@ -274,26 +274,23 @@ static int scePowerUnregisterCallback(int slotId) {
|
||||
}
|
||||
|
||||
static int sceKernelPowerLock(int lockType) {
|
||||
DEBUG_LOG(Log::HLE, "0=sceKernelPowerLock(%i)", lockType);
|
||||
if (lockType == 0) {
|
||||
return 0;
|
||||
return hleLogDebug(Log::HLE, 0);
|
||||
} else {
|
||||
return SCE_KERNEL_ERROR_INVALID_MODE;
|
||||
return hleLogError(Log::HLE, SCE_KERNEL_ERROR_INVALID_MODE);
|
||||
}
|
||||
}
|
||||
|
||||
static int sceKernelPowerUnlock(int lockType) {
|
||||
DEBUG_LOG(Log::HLE, "0=sceKernelPowerUnlock(%i)", lockType);
|
||||
if (lockType == 0) {
|
||||
return 0;
|
||||
return hleLogDebug(Log::HLE, 0);
|
||||
} else {
|
||||
return SCE_KERNEL_ERROR_INVALID_MODE;
|
||||
return hleLogError(Log::HLE, SCE_KERNEL_ERROR_INVALID_MODE);
|
||||
}
|
||||
}
|
||||
|
||||
static int sceKernelPowerTick(int flag) {
|
||||
DEBUG_LOG(Log::HLE, "UNIMPL 0=sceKernelPowerTick(%i)", flag);
|
||||
return 0;
|
||||
return hleLogDebug(Log::HLE, 0, "UNIMPL");
|
||||
}
|
||||
|
||||
int KernelVolatileMemLock(int type, u32 paddr, u32 psize) {
|
||||
@@ -487,7 +484,7 @@ static u32 scePowerSetClockFrequency(u32 pllfreq, u32 cpufreq, u32 busfreq) {
|
||||
}
|
||||
if (GetLockedCPUSpeedMhz() <= 0)
|
||||
CoreTiming::SetClockFrequencyHz(PowerCpuMhzToHz(cpufreq, pllFreq));
|
||||
return 0;
|
||||
return hleNoLog(0);
|
||||
}
|
||||
|
||||
static u32 scePowerSetCpuClockFrequency(u32 cpufreq) {
|
||||
@@ -556,16 +553,12 @@ static float scePowerGetBusClockFrequencyFloat() {
|
||||
}
|
||||
|
||||
static int scePowerTick() {
|
||||
DEBUG_LOG(Log::sceMisc, "scePowerTick()");
|
||||
// Don't think we need to do anything.
|
||||
return 0;
|
||||
return hleLogDebug(Log::sceMisc, 0);
|
||||
}
|
||||
|
||||
|
||||
static u32 IsPSPNonFat() {
|
||||
DEBUG_LOG(Log::sceMisc, "%d=scePower_a85880d0_IsPSPNonFat()", g_Config.iPSPModel);
|
||||
|
||||
return g_Config.iPSPModel;
|
||||
return hleLogDebug(Log::sceMisc, g_Config.iPSPModel);
|
||||
}
|
||||
|
||||
static const HLEFunction scePower[] = {
|
||||
|
||||
@@ -486,18 +486,16 @@ static u32 sceUtilityLoadAvModule(u32 module)
|
||||
return SCE_ERROR_AV_MODULE_BAD_ID;
|
||||
}
|
||||
|
||||
INFO_LOG(Log::sceUtility, "0=sceUtilityLoadAvModule(%i)", module);
|
||||
if (module == 0)
|
||||
JpegNotifyLoadStatus(1);
|
||||
return hleDelayResult(0, "utility av module loaded", 25000);
|
||||
return hleDelayResult(hleLogSuccessInfoI(Log::sceUtility, 0), "utility av module loaded", 25000);
|
||||
}
|
||||
|
||||
static u32 sceUtilityUnloadAvModule(u32 module)
|
||||
{
|
||||
INFO_LOG(Log::sceUtility,"0=sceUtilityUnloadAvModule(%i)", module);
|
||||
if (module == 0)
|
||||
JpegNotifyLoadStatus(-1);
|
||||
return hleDelayResult(0, "utility av module unloaded", 800);
|
||||
return hleDelayResult(hleLogSuccessInfoI(Log::sceUtility, 0), "utility av module unloaded", 800);
|
||||
}
|
||||
|
||||
static const ModuleLoadInfo *__UtilityModuleInfo(int module) {
|
||||
|
||||
Reference in new issue
Block a user