Skip to content

Commit a0bcd41

Browse files
committed
add dogbait
1 parent 08181ea commit a0bcd41

7 files changed

Lines changed: 144 additions & 0 deletions

File tree

iop/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ SUBDIRS = \
2222
sound \
2323
startup \
2424
system \
25+
system2x6 \
2526
tcpip \
2627
usb
2728

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

0 commit comments

Comments
 (0)