Skip to content

Commit

Permalink
Tas Record+Replay
Browse files Browse the repository at this point in the history
  • Loading branch information
Niko committed Oct 31, 2024
1 parent 1899d3e commit efe796e
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 5 deletions.
11 changes: 9 additions & 2 deletions mods/Tests/TasRecorder/src/GAMEPAD_ProcessTapRelease.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,15 @@ void DECOMP_GAMEPAD_ProcessTapRelease(struct GamepadSystem *gGamepads)
// value pressed
hold = buttonArr[currIndex];

// record
pad->buttonsHeldCurrFrame = buttonArr[currIndex];
// replay
pad->buttonsHeldCurrFrame = hold;

// In this order: Up, Down, Left, Right
if ((hold & 1) != 0) pad->stickLY = 0;
if ((hold & 2) != 0) pad->stickLY = 0xFF;
if ((hold & 4) != 0) pad->stickLX = 0;
if ((hold & 8) != 0) pad->stickLX = 0xFF;

}

// draw
Expand Down
15 changes: 12 additions & 3 deletions mods/Windows/TasRecorder/OculusTest/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ int main()

int pid;
printf("Enter DuckStation PID: ");
scanf("%d\n", &pid);
scanf("%d", &pid);

char duckName[100];
sprintf_s(duckName, 100, "duckstation_%d", pid);
Expand All @@ -43,16 +43,24 @@ int main()
HANDLE hFile = OpenFileMapping(FILE_MAP_READ | FILE_MAP_WRITE, FALSE, duckNameT);
pBuf = (char*)MapViewOfFile(hFile, FILE_MAP_READ | FILE_MAP_WRITE, 0, 0, size);

if (pBuf == 0)
{
printf("Failed to open\n");
system("pause");
exit(0);
}

system("cls");
printf("1 - Save\n");
printf("2 - Load\n");
printf("Enter: ");

scanf("%d\n", &pid);
scanf("%d", &pid);

// SAVE mode
if (pid == 1)
{
system("cls");
printf("Saving...\n");

int sizeInt = *(int*)&pBuf[0xfff0];
Expand All @@ -66,9 +74,10 @@ int main()
else
{
system("cls");
printf("Enter File Name: ");

char name[100];
scanf("%s\n", &name[0]);
scanf("%s", &name[0]);

FILE* fp;

Expand Down
8 changes: 8 additions & 0 deletions mods/Windows/TasRecorder_Release/Directions.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
Before Record/Replay
Open DuckStation
Go to Settings
Go to Advanced
Enable "Export Shared Memory"
Close Settings
Close DuckStation

Recording a TAS:
Open the modded ROM in DuckStation
Play any 1P mode (multiplayer comes later)
Expand Down
Binary file added mods/Windows/TasRecorder_Release/TasRecorder.exe
Binary file not shown.
Binary file modified mods/Windows/TasRecorder_Release/ctr-u_TasRecorder.xdelta
Binary file not shown.

0 comments on commit efe796e

Please sign in to comment.