MCPcopy Create free account
hub / github.com/ThirteenAG/WidescreenFixesPack / OnModuleStart

Function OnModuleStart

source/GTALCS.PPSSPP.WidescreenFix/main.c:355–884  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

353}
354
355int OnModuleStart() {
356 sceKernelDelayThread(100000); //added cuz game gets stuck on a loadscreen between islands otherwise, idk why
357
358 int SkipIntro = inireader.ReadInteger("MAIN", "SkipIntro", 1);
359
360 if (SkipIntro)
361 {
362 uintptr_t ptr = pattern.get_first("00 00 00 00 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 25 20 00 00 ? ? ? ? 00 00 00 00 ? ? ? ? 00 00 00 00 25 10 00 00", -4);
363 injector.MakeNOP(ptr);
364 }
365
366 UnthrottleEmuDuringLoading = inireader.ReadInteger("MAIN", "UnthrottleEmuDuringLoading", 1);
367
368 if (UnthrottleEmuDuringLoading)
369 {
370 UnthrottleEmuEnable();
371 }
372
373 char szForceAspectRatio[100];
374 int DualAnalogPatch = inireader.ReadInteger("MAIN", "DualAnalogPatch", 1);
375 char* ForceAspectRatio = inireader.ReadString("MAIN", "ForceAspectRatio", "auto", szForceAspectRatio, sizeof(szForceAspectRatio));
376 int Enable60FPS = inireader.ReadInteger("MAIN", "Enable60FPS", 0);
377
378 int ModernControlScheme = inireader.ReadInteger("CONTROLS", "ModernControlScheme", 0);
379
380 float fHudScale = inireader.ReadFloat("HUD", "HudScale", 1.0f);
381
382 float fRadarScale = inireader.ReadFloat("RADAR", "RadarScale", 1.0f);
383 float fRadarPosX = inireader.ReadFloat("RADAR", "RadarPosX", 12.0f);
384 float fRadarPosY = inireader.ReadFloat("RADAR", "RadarPosY", 196.0f);
385
386 float fMPRadarScale = inireader.ReadFloat("MPRADAR", "RadarScale", 1.0f);
387 float fMPRadarPosY = inireader.ReadFloat("MPRADAR", "RadarPosY", 170.0f);
388
389 if (DualAnalogPatch)
390 {
391 // Implement right analog stick
392 uintptr_t ptr = pattern.get_first("06 00 00 10 ? 00 A7 A3", 0);
393 injector.WriteInstr(ptr + 0x24,
394 sh(a1, sp, 0x10)
395 );
396 injector.WriteInstr(ptr + 0x1C,
397 lhu(a1, sp, 0x1E)
398 );
399
400 // Redirect camera movement
401 ptr = pattern.get_first("34 00 80 14 ? ? ? ? ? ? ? ? ? ? ? ? 14 00 40 10", 0);
402 injector.MakeNOP(ptr + 0x00);
403 injector.WriteMemory8(ptr + 0x10 + 0x2, 0x00); // beqz -> b
404 injector.MakeJAL(ptr + 0x84, (intptr_t)CPad__GetRightStickX);
405 injector.MakeNOP(ptr + 0x100);
406 injector.WriteMemory8(ptr + 0x110 + 0x2, 0x00); // beqz -> b
407 injector.MakeJAL(ptr + 0x13C, (intptr_t)CPad__GetRightStickY);
408
409 // Redirect gun aim movement
410 ptr = pattern.get_first("36 00 80 04 ? ? ? ? 34 00 80 10", 0);
411 injector.MakeJAL(ptr + 0x3C, (intptr_t)aimX);
412 injector.MakeJAL(ptr + 0x68, (intptr_t)aimX);

Callers 1

module_startFunction · 0.70

Calls 15

str2intFunction · 0.85
UnthrottleEmuEnableFunction · 0.70
GetAbsoluteAddressFunction · 0.70
adjustRightXFunction · 0.70
adjustTopRightYFunction · 0.70
adjustBottomRightYFunction · 0.70
shFunction · 0.50
lhuFunction · 0.50
lhFunction · 0.50
_orFunction · 0.50
beqFunction · 0.50
nopFunction · 0.50

Tested by

no test coverage detected