Skip to content

Commit b07e273

Browse files
committed
add dogbait
1 parent 08181ea commit b07e273

6 files changed

Lines changed: 140 additions & 0 deletions

File tree

iop/system2x6/Makefile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# _____ ___ ____ ___ ____
2+
# ____| | ____| | | |____|
3+
# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
4+
#-----------------------------------------------------------------------
5+
# Copyright 2001-2004, ps2dev - http://www.ps2dev.org
6+
# Licenced under Academic Free License version 2.0
7+
# Review ps2sdk README & LICENSE files for further details.
8+
9+
SUBDIRS = dogbait
10+
11+
include $(PS2SDKSRC)/Defs.make
12+
include $(PS2SDKSRC)/Rules.make

iop/system2x6/dogbait/Makefile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# _____ ___ ____ ___ ____
2+
# ____| | ____| | | |____|
3+
# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
4+
#-----------------------------------------------------------------------
5+
# Copyright 2001-2009, ps2dev - http://www.ps2dev.org
6+
# Licenced under Academic Free License version 2.0
7+
# Review ps2sdk README & LICENSE files for further details.
8+
9+
IOP_BIN = dogbait.irx
10+
IOP_SRC_DIR = src/
11+
IOP_OBJS = main.o imports.o
12+
13+
include $(PS2SDKSRC)/Defs.make
14+
include $(PS2SDKSRC)/iop/Rules.bin.make
15+
include $(PS2SDKSRC)/iop/Rules.make
16+
include $(PS2SDKSRC)/iop/Rules.release

iop/system2x6/dogbait/README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Dogbait
2+
3+
This module provides a thread to trick the namco arcade system 246/256 watchdog, to avoit it from shutting down the machine if security dongle is not connected for some time.
4+
5+
its implementation could be considered a fussion of `rom0:LED` and `rom0:DAEMON` (without dongle spamming)
6+
7+
## How to use this module in your program
8+
9+
Use `SifLoadStartModule` or `LoadModuleBuffer` directly.
10+
11+
due to the purpose of this module, checking if the module loaded successfully and stayed resident on IOP is important
12+
13+
like this:
14+
```c
15+
int ret, id;
16+
id = LoadModuleBuffer(dogbait_irx, size_dogbait_irx, 0, NULL, &ret);
17+
if (id<0 || ret == 1) we_have_an_error();
18+
```
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
thbase_IMPORTS_start
2+
I_CreateThread
3+
I_StartThread
4+
I_DelayThread
5+
thbase_IMPORTS_end
6+
7+
stdio_IMPORTS_start
8+
I_printf
9+
stdio_IMPORTS_end
10+
11+
intrman_IMPORTS_start
12+
I_CpuEnableIntr
13+
intrman_IMPORTS_end
14+
15+
cdvdman_IMPORTS_start
16+
I_sceCdApplySCmd
17+
cdvdman_IMPORTS_end
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
# _____ ___ ____ ___ ____
3+
# ____| | ____| | | |____|
4+
# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
5+
#-----------------------------------------------------------------------
6+
# Copyright 2001-2009, ps2dev - http://www.ps2dev.org
7+
# Licenced under Academic Free License version 2.0
8+
# Review ps2sdk README & LICENSE files for further details.
9+
#
10+
# Defines all IRX imports.
11+
*/
12+
13+
#ifndef IOP_IRX_IMPORTS_H
14+
#define IOP_IRX_IMPORTS_H
15+
16+
#include <irx.h>
17+
18+
/* Please keep these in alphabetical order! */
19+
20+
#include <intrman.h>
21+
#include <loadcore.h>
22+
#include <cdvdman.h>
23+
#include <stdio.h>
24+
#include <thbase.h>
25+
26+
#endif /* IOP_IRX_IMPORTS_H */

iop/system2x6/dogbait/src/main.c

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#include "irx_imports.h"
2+
3+
#define MODNAME "dogbait"
4+
#ifdef DEBUG
5+
#define DPRINTF(fmt, x...) printf(MODNAME ": " fmt, ##x)
6+
#else
7+
#define DPRINTF(x...)
8+
#endif
9+
10+
IRX_ID(MODNAME, 2, 11);
11+
//thanks uyjulian for the idea
12+
char rdata[16];
13+
char wdata[2] = {0x42, (char)(1 << 8)};
14+
15+
//the loop waiting was made to mirror what rom0:DAEMON did
16+
void bait(void*)
17+
{
18+
int x;
19+
printf("fake check card routine start\n");
20+
do {
21+
#ifdef DEBUG
22+
x =
23+
#endif
24+
sceCdApplySCmd(0x1c, wdata, sizeof(wdata), rdata);
25+
DPRINTF("sceCdApplySCmd() ret %d\n", x);
26+
x = 0x3c;
27+
while (0 < x) {
28+
DelayThread(1000000);
29+
x = x + -1;
30+
}
31+
} while(1);
32+
}
33+
34+
int _start(int argc, char** argv)
35+
{
36+
int x;
37+
iop_thread_t T;
38+
CpuEnableIntr();
39+
T.attr = 0x2000000;
40+
T.thread = bait;
41+
T.priority = 0x7e;
42+
T.stacksize = 0x800;
43+
T.option = 0;
44+
x = CreateThread(&T);
45+
if (x > 0) {
46+
DPRINTF("Starting Thread\n");
47+
StartThread(x,0);
48+
return MODULE_RESIDENT_END;
49+
} else {DPRINTF("CreateThread: %d\n", x);}
50+
return MODULE_NO_RESIDENT_END;
51+
}

0 commit comments

Comments
 (0)