summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/codehandler.cpp36
-rw-r--r--src/codehandler.obin5772 -> 0 bytes
2 files changed, 24 insertions, 12 deletions
diff --git a/src/codehandler.cpp b/src/codehandler.cpp
index b1d67d2..38d426d 100644
--- a/src/codehandler.cpp
+++ b/src/codehandler.cpp
@@ -1,4 +1,10 @@
-#include <common.h>
+//#include <common.h>
+typedef char s8;
+typedef short s16;
+typedef int s32;
+typedef unsigned char u8;
+typedef unsigned short u16;
+typedef unsigned int u32;
u8 frozen_value = 0;
u32 regbuffer[72] = {0};
@@ -13,11 +19,14 @@ u8 cmd;
*/
#define PACKET_SIZE 0xF800
+#define GCACK 0xAA
+#define GCRETRY 0xBB
+#define GCFAIL 0xCC
extern "C" void writebranch(u32 source, u32 destination);
extern "C" void bphandler();
-// return true if remainder
+/* return true if remainder */
bool _packetdivide(u32 memrange, u32 size, u32* full, u32* remainder) {
*full = memrange / size;
*remainder = memrange % size;
@@ -121,8 +130,10 @@ void exisendbuffer(u32 counter, u8* buffer) {
}
}
+/* FIXME MegaGecko version */
void versionnumber() {
// send 0x80 for wii
+ // send something else for MegaGecko
exisendbyte(0x80);
}
@@ -140,7 +151,8 @@ void unfreezegame() {
//OSReport("frozen_value: %d\n", frozen_value);
}
-u8 get_frozenvalue() {
+/* INLINE? */
+inline u8 get_frozenvalue() {
return frozen_value;
}
@@ -177,7 +189,7 @@ void writebyte() {
//FIXME removed upload
/*
void upbpdata() {
- exisendbyte(0xAA);
+ exisendbyte(GCACK);
upload(regbuffer, 40*4);
}
*/
@@ -186,7 +198,7 @@ void getbpdata() {
exisendbuffer(72*4, (u8*)regbuffer);
}
-//returns false if we need to go to resume and not finish
+/* returns false if we need to go to resume and not finish */
bool breakpoints(u8 type) {
//FIXME
u32 _bphandler = (u32)bphandler;
@@ -246,7 +258,7 @@ void cancelbreakpoints() {
}
void readmem() {
- exisendbyte(0xAA);
+ exisendbyte(GCACK);
exireceivebuffer(8, (u8*)dwordbuffer);
@@ -271,11 +283,11 @@ void readmem() {
ret2 = exireceivebyte(&byte);
}
- if(byte == 0xCC) {
+ if(byte == GCFAIL) {
goto done_readmem;
- }else if(byte == 0xBB) {
+ }else if(byte == GCRETRY) {
ret3 = true;
- }else if(byte == 0xAA) {
+ }else if(byte == GCACK) {
location += PACKET_SIZE;
full--;
ret3 = true;
@@ -296,11 +308,11 @@ void readmem() {
ret2 = exireceivebyte(&byte);
}
- if(byte == 0xCC) {
+ if(byte == GCFAIL) {
goto done_readmem;
- }else if(byte == 0xBB) {
+ }else if(byte == GCRETRY) {
ret3 = true;
- }else if(byte == 0xAA) {
+ }else if(byte == GCACK) {
location += remainder;
remainder = 0;
ret3 = true;
diff --git a/src/codehandler.o b/src/codehandler.o
deleted file mode 100644
index d14757e..0000000
--- a/src/codehandler.o
+++ /dev/null
Binary files differ