Skip to content

Commit

Permalink
v8: newly supported games and cores
Browse files Browse the repository at this point in the history
  • Loading branch information
garungorp committed Apr 12, 2023
1 parent 8bd8efc commit 5b188b9
Show file tree
Hide file tree
Showing 12 changed files with 770 additions and 46 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,13 @@ An external app that injects cursor input into game memory.
| :---: | :---: | :---: |
| N64 | Mupen64Plus-Next | 2.4-Vulkan bc24153 |
| PS1 | Beetle PSX HW | 0.9.44.1 234433f |
| PS1 | Beetle PSX | 0.9.44.1 6ed5790 |
| PS1 | PCSX-ReARMed | r23l 4373e29 |
| PS1 | DuckStation | |
| PS1 | SwanStation | 1.00 bc5f6c8 |
| SNES | bsnes-mercury Balanced | v094 |
* NOTE: For RetroArch the window needs to be focused for it to hook initially.
* NOTE: All cores have not been tested exhaustively

## How to Use
1. Start emulator first
Expand Down Expand Up @@ -80,6 +83,8 @@ avoid clicking off the window.
| Hellnight (Europe) | SLES-01562 | Good | <sup>Requires supplied cheat file, Not fully tested</sub> | **Hellnight_SLES-10562.cht** |
| Aquanaut's Holiday (USA) | SCUS-94603 | Good | <sup>Requires supplied cheat file, Very little testing</sub> | **AquanautsHoliday_SCUS-94603.cht** |
| Future Cop: L.A.P.D. (USA) | SLUS-00739 | Fair | <sup>Not fully tested</sub> | |
| Duke Nukem: Time to Kill (USA) | SLUS-00583 | Fair | <sup>Requires supplied cheat file, Not fully tested</sub> | **DukeNukemTimeToKill_SLUS-00583.cht** |
| Jumping Flash (USA) | SCUS-94103 | Good | <sup>Requires supplied cheat file</sub> | **JumpingFlash_SCUS-94103.cht** |
* NOTE: If DuckStation is not hooking, try restoring the default settings. 'Settings->General->Restore Defaults'
* Importing cheat files in DuckStation: 'Tools->Cheat Manager->Cheat List->Import->From File'

Expand Down Expand Up @@ -121,6 +126,8 @@ avoid clicking off the window.
| Resident Evil: Dead Aim (USA) | SLUS-20669 | Good | <sup>**Requires supplied cheat file**, Third-person camera y-axis not supported</sub> | | **FBB5290C.pnach** |
| Michigan: Report from Hell (Europe) | SLES-53073 | Fair | <sup>Door peek camera not supported, Not fully tested</sub> | | |
| Ninja Assault (USA) | SLUS-20492 | Good | <sup>**Requires supplied cheat file to disable aim-lock**, Not fully tested</sub> | | **785B28DA.pnach** |
| Robotech: Invasion (USA) | SLUS-20823 | Fair | <sup>Turrets not supported, Not fully tested</sub> | | |
| Serious Sam: Next Encounter (USA) | SLUS-20907 | Good | <sup>Not fully tested</sub> | Auto Center: Off, Auto Aim: Off | |
* NOTE: PCSX2 will only hook with **BIOS versions 5XXXX and up**.
* NOTE: Some aspects may break when a game is started with overclocking. Requires testing.
* PCSX2 Settings: **Disable** *'Settings->Interface->Double-Click Toggles Fullscreen'* | **Enable** *'Settings->Interface->Hide Cursor In Fullscreen'*
Expand Down
8 changes: 8 additions & 0 deletions cheats/PS1/DukeNukemTimeToKill_SLUS-00583.cht
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#group=MouseInjector
#type=Gameshark
#activation=EndFrame
[*Disable Rotate X]
E00092D4 0053
80057ADC 0000
E00092D4 0053
80057ADE 0000
77 changes: 77 additions & 0 deletions cheats/PS1/JumpingFlash_SCUS-94103.cht
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#group=Mouse Injector
#type=Gameshark
#activation=EndFrame
[*Disable CamY]
D00DD762 AC82
800DD75C 0000
D00DD762 AC82
800DD75E 0000
D00DD762 AC82
800DD770 0000
D00DD762 AC82
800DD772 0000
D00DD3E2 AC82
800DD3DC 0000
D00DD3E2 AC82
800DD3DE 0000
D00DD3E2 AC82
800DD3F0 0000
D00DD3E2 AC82
800DD3F2 0000
D00CB7B2 AC82
800CB7AC 0000
D00CB7B2 AC82
800CB7AE 0000
D00CB7B2 AC82
800CB7C0 0000
D00CB7B2 AC82
800CB7C2 0000
D00DD54E AC82
800DD548 0000
D00DD54E AC82
800DD54A 0000
D00DD54E AC82
800DD55C 0000
D00DD54E AC82
800DD55E 0000
D00E2432 AC82
800E242C 0000
D00E2432 AC82
800E242E 0000
D00E2432 AC82
800E2440 0000
D00E2432 AC82
800E2442 0000
D00DAFCA AC82
800DAFC4 0000
D00DAFCA AC82
800DAFC6 0000
D00DAFCA AC82
800DAFD8 0000
D00DAFCA AC82
800DAFDA 0000
D00DD3F2 AC82
800DD3EC 0000
D00DD3F2 AC82
800DD3EE 0000
D00DD3F2 AC82
800DD400 0000
D00DD3F2 AC82
800DD402 0000
D00DD566 AC82
800DD560 0000
D00DD566 AC82
800DD562 0000
D00DD566 AC82
800DD574 0000
D00DD566 AC82
800DD576 0000
D00E2336 AC82
800E2330 0000
D00E2336 AC82
800E2332 0000
D00E2336 AC82
800E2344 0000
D00E2336 AC82
800E2346 0000

14 changes: 12 additions & 2 deletions games/game.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@ extern const GAMEDRIVER *GAME_PS2_GREGMAXD;
extern const GAMEDRIVER *GAME_PS2_SHSHATTEREDMEMORIES;
extern const GAMEDRIVER *GAME_PS1_DUKETIMETOKILL;
extern const GAMEDRIVER *GAME_PS1_FUTURECOP;
extern const GAMEDRIVER *GAME_PS2_ROBOTECHINVASION;
extern const GAMEDRIVER *GAME_PS2_SERIOUSSAMNE;
extern const GAMEDRIVER *GAME_SS_PANZERDRAGOON;
extern const GAMEDRIVER *GAME_PS2_STATEOFEMERGENCY2;
extern const GAMEDRIVER *GAME_PS2_RACUPYOURARSENAL;

static const GAMEDRIVER **GAMELIST[] =
{
Expand Down Expand Up @@ -168,7 +173,7 @@ static const GAMEDRIVER **GAMELIST[] =
&GAME_PS1_JUMPINGFLASH,
&GAME_PS1_KINGSFIELD,
&GAME_PS1_KINGSFIELD2,
&GAME_SS_POWERSLAVE,
// &GAME_SS_POWERSLAVE,
&GAME_PS1_KINGSFIELD3,
&GAME_PS2_KINGSFIELD4,
&GAME_SD_MAKENX,
Expand Down Expand Up @@ -208,7 +213,12 @@ static const GAMEDRIVER **GAMELIST[] =
&GAME_PS2_GREGMAXD,
&GAME_PS2_SHSHATTEREDMEMORIES,
&GAME_PS1_DUKETIMETOKILL,
&GAME_PS1_FUTURECOP
&GAME_PS1_FUTURECOP,
&GAME_PS2_ROBOTECHINVASION,
&GAME_PS2_SERIOUSSAMNE,
&GAME_SS_PANZERDRAGOON,
&GAME_PS2_STATEOFEMERGENCY2,
&GAME_PS2_RACUPYOURARSENAL
};

static const GAMEDRIVER *CURRENT_GAME = NULL;
Expand Down
23 changes: 16 additions & 7 deletions games/ps1_dukettk.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
// 0808 climbing mount/dismount
// 0909 jumping/falling

#define TTK_CLIMB_MEDIUM 0xD71FD

static uint8_t PS1_TTK_Status(void);
static uint8_t PS1_TTK_CanRotate(void);
static void PS1_TTK_Inject(void);
Expand Down Expand Up @@ -88,11 +90,19 @@ static uint8_t PS1_TTK_CanRotate(void)
switch (action) {
case TTK_ACTION_SWIMMING:
case TTK_ACTION_FLOATING:
case TTK_ACTION_CLIMBING:
case TTK_ACTION_JETPACK:
return 1;
}

if (action == TTK_ACTION_CLIMBING)
{
// on chain?
if (PS1_MEM_ReadByte(TTK_CLIMB_MEDIUM) == 0x9)
return 1;
else
return 0;
}

if (!action)
return 1;

Expand All @@ -105,18 +115,17 @@ static uint8_t PS1_TTK_CanRotate(void)
static void PS1_TTK_Inject(void)
{
// TODO: disable 1st-person to previous 3rd-person snap
// TODO: disable rotation while on ladders but not chains

if(xmouse == 0 && ymouse == 0) // if mouse is idle
return;

const float scale = 250.f;
const float looksensitivity = (float)sensitivity / 20.f;
const float scale = 3.f;

int32_t camY = PS1_MEM_ReadInt(TTK_CAMY);
float camYF = (float)camY;
float ym = (float)(invertpitch ? -ymouse : ymouse);
camYF += ym * looksensitivity / (scale / (scale * 16.f));
camYF += ym * looksensitivity / 0.5f * scale;

camYF = ClampFloat(camYF, -4070.f, 4070.f);

Expand All @@ -129,7 +138,7 @@ static void PS1_TTK_Inject(void)
if (camXCosF < 0)
angle -= TAU / 2.f;

angle += (float)xmouse * looksensitivity / (scale / (scale * 0.0025f));
angle += (float)xmouse * looksensitivity / 2592.f * scale;

camXSinF = sin(angle) * 4096;
camXCosF = cos(angle) * 4096;
Expand All @@ -138,7 +147,7 @@ static void PS1_TTK_Inject(void)
{
uint16_t camXRot = PS1_MEM_ReadHalfword(TTK_CAMX_ROT);
float camXRotF = (float)camXRot;
float dx = (float)xmouse * looksensitivity * (scale / (scale * 0.95f));
float dx = (float)xmouse * looksensitivity / 4.f * scale;
AccumulateAddRemainder(&camXRotF, &xAccumulator, (float)xmouse, dx);

while (camXRotF > 4096)
Expand All @@ -154,7 +163,7 @@ static void PS1_TTK_Inject(void)
{
int16_t camYRot = PS1_MEM_ReadInt16(TTK_CAMY_ROT);
float camYRotF = (float)camYRot;
float dy = -(float)ymouse * looksensitivity * (scale / (scale * 0.95));
float dy = -(float)ymouse * looksensitivity / 4.5f * scale;
AccumulateAddRemainder(&camYRotF, &yAccumulator, -(float)ymouse, dy);

camYRotF = ClampFloat(camYRotF, -900.f, 900.f);
Expand Down
59 changes: 22 additions & 37 deletions games/ps1_jumpingflash.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,15 @@

#define JF_CAMBASE 0x1FFE7C
#define JF_CAMBASE_SANITY_1_VALUE 0x450B0010
#define JF_CAMBASE_SANITY_2_VALUE 0x17040010
// offsets from cambase
#define JF_CAMX 0x74
#define JF_CAMY 0x78
#define JF_CAMY_SIGN 0x7A
#define JF_CAMBASE_SANITY_1 -0x30
#define JF_DISABLE_CAMY 0xDD760

// #define JF_CAMX 0x138144
// #define JF_CAMY 0x138148
// #define JF_CAMY_SIGN 0x13814A
#define JF_AUTO_LOOK_BELOW 0x102724
#define JF_IS_STAGE_CLEAR 0x1FDBE0
#define JF_IS_PAUSED 0x47E54

static uint8_t PS1_JF_Status(void);
static uint8_t PS1_JF_IsCambaseValid(void);
Expand All @@ -63,12 +60,20 @@ static float yAccumulator = 0.f;
//==========================================================================
static uint8_t PS1_JF_Status(void)
{
return (PS1_MEM_ReadWord(0x943C) == 0x53435553U && PS1_MEM_ReadWord(0x9440) == 0x5F393431U && PS1_MEM_ReadWord(0x9444) == 0x2E30333BU);
return (PS1_MEM_ReadWord(0x943C) == 0x53435553U &&
PS1_MEM_ReadWord(0x9440) == 0x5F393431U &&
PS1_MEM_ReadWord(0x9444) == 0x2E30333BU);

// for no$psx debugger
// return (PS1_MEM_ReadWord(0x0) == 0x03000000 &&
// PS1_MEM_ReadWord(0x4) == 0x800C5A27 &&
// PS1_MEM_ReadWord(0x8) == 0x08004003);
}

static uint8_t PS1_JF_IsCambaseValid(void)
{
if (PS1_MEM_ReadWord(camBase + JF_CAMBASE_SANITY_1) == JF_CAMBASE_SANITY_1_VALUE){
if (PS1_MEM_ReadWord(camBase + JF_CAMBASE_SANITY_1) == JF_CAMBASE_SANITY_1_VALUE ||
PS1_MEM_ReadWord(camBase + JF_CAMBASE_SANITY_1) == JF_CAMBASE_SANITY_2_VALUE){
return 1;
}
return 0;
Expand All @@ -77,7 +82,8 @@ static uint8_t PS1_JF_IsCambaseValid(void)
static uint8_t PS1_JF_DetectCambase(void)
{
uint32_t tempCamBase = PS1_MEM_ReadPointer(JF_CAMBASE);
if (PS1_MEM_ReadWord(tempCamBase + JF_CAMBASE_SANITY_1) == JF_CAMBASE_SANITY_1_VALUE)
if (PS1_MEM_ReadWord(tempCamBase + JF_CAMBASE_SANITY_1) == JF_CAMBASE_SANITY_1_VALUE ||
PS1_MEM_ReadWord(tempCamBase + JF_CAMBASE_SANITY_1) == JF_CAMBASE_SANITY_2_VALUE)
{
camBase = tempCamBase;
return 1;
Expand All @@ -91,14 +97,7 @@ static uint8_t PS1_JF_DetectCambase(void)
//==========================================================================
static void PS1_JF_Inject(void)
{
// TODO: find auto-center cheat/solution that doesn't wholly disable camY movement with controller
// TODO: disable mouse movement on stage clear, on platform, boss defeated
// TODO: disable mouse movement in menu/paused
// TODO: find cheat for Extra World 2

// PS1_MEM_WriteWord(JF_AUTO_LOOK_BELOW, 0x0);

// PS1_MEM_WriteWord(JF_DISABLE_CAMY, 0x0);
// TODO: find better camBase sanity

if(xmouse == 0 && ymouse == 0) // if mouse is idle
return;
Expand All @@ -112,9 +111,12 @@ static void PS1_JF_Inject(void)

if (PS1_MEM_ReadWord(JF_IS_STAGE_CLEAR))
return;

if (PS1_MEM_ReadWord(JF_IS_PAUSED))
return;

uint16_t camX = PS1_MEM_ReadHalfword(camBase + JF_CAMX);
uint16_t camY = PS1_MEM_ReadHalfword(camBase + JF_CAMY);
int16_t camY = PS1_MEM_ReadInt16(camBase + JF_CAMY);
float camXF = (float)camX;
float camYF = (float)camY;

Expand All @@ -128,26 +130,9 @@ static void PS1_JF_Inject(void)
float dy = -ym * looksensitivity * scale;
AccumulateAddRemainder(&camYF, &yAccumulator, -ym, dy);

camX = (uint16_t)camXF;
camY = (uint16_t)camYF;

// if (camYF < 0 || camY > 32000)
if (camY > 32000)
PS1_MEM_WriteHalfword(camBase + JF_CAMY_SIGN, 0xFFFF);
else
PS1_MEM_WriteHalfword(camBase + JF_CAMY_SIGN, 0x0);


// clamp y-axis
if (camY > 776 && camY < 32000)
camY = 776;
if (camY < 64640 && camY > 32000)
camY = 64640;

PS1_MEM_WriteHalfword(camBase + JF_CAMX, (uint16_t)camX);
PS1_MEM_WriteHalfword(camBase + JF_CAMY, (uint16_t)camY);
camYF = ClampFloat(camYF, -896, 896);

// PS1_MEM_WriteHalfword(JF_CAMX, (uint16_t)camXF);
// PS1_MEM_WriteHalfword(JF_CAMY, (uint16_t)camYF);
// PS1_MEM_WriteWord(JF_CAMY, (uint32_t)camYF);
PS1_MEM_WriteHalfword(camBase + JF_CAMX, (uint16_t)camXF);
PS1_MEM_WriteInt16(camBase + JF_CAMY, (int16_t)camYF);
}
Loading

0 comments on commit 5b188b9

Please sign in to comment.