patches-src/disable_network/patch.c
Philip Minakov d55f3fcce3
Add patches
2024-11-10 11:41:26 +04:00

32 lines
776 B
C

#include <swilib.h>
#ifdef SGOLD
#ifdef S65_58
#include "S65_58.h"
#endif
#endif
#define _GBS_SendMessage ((void (*)(int cepid_to, int msg, ...))(ADDR_GBS_SendMessage))
#define _DisableNetwork ((void (*)())(ADDR_DisableNetwork))
#define GetUnk ((int (*)())(ADDR_GetUnk))
#define IsSimPresent() (*ADDR_RamIsSimPresent)
__attribute__((section(".text.DisableNetwork")))
void DisableNetwork(void) {
_GBS_SendMessage(0x4058, 7, 0, 0, 0);
}
__attribute__((section(".text.EnableNetwork")))
void EnableNetwork(void) {
_GBS_SendMessage(0x4058, 8, 0, 0, 0);
}
__attribute__((target("thumb")))
__attribute__((section(".text.AutoDisableNetwork")))
int AutoDisableNetwork() {
if (!IsSimPresent()) {
_DisableNetwork();
}
return GetUnk();
}