Permalink
Browse files

Convert tabs to spaces.

  • Loading branch information...
1 parent 2c8a422 commit ec540c02d9083f119637539b234e5680728cecd9 @root670 committed Feb 12, 2016
Showing with 4,471 additions and 4,471 deletions.
  1. +121 −121 bootstrap/main.c
  2. +331 −331 cheats.c
  3. +10 −10 cheats.h
  4. +182 −184 database.c
  5. +7 −7 database.h
  6. +43 −43 engine/engine.c
  7. +267 −267 engine/test.c
  8. +268 −267 graphics.c
  9. +1,036 −1,036 libraries/upng.c
  10. +46 −46 libraries/upng.h
  11. +31 −31 main.c
  12. +254 −254 menus.c
  13. +14 −14 menus.h
  14. +937 −937 saves.c
  15. +4 −4 saves.h
  16. +111 −110 saveutil.h
  17. +92 −92 settings.c
  18. +130 −130 startgame.c
  19. +212 −212 textcheats.c
  20. +375 −375 util.c
View
@@ -25,140 +25,140 @@ int white = 0xEBEBEB; /* WHITE: Failed to launch OSDSYS */
int purple = 0x801080; /* PURPLE: Launching uLaunchELF */
int black = 0x101010;
-#define ELF_MAGIC 0x464c457f
-#define ELF_PT_LOAD 1
+#define ELF_MAGIC 0x464c457f
+#define ELF_PT_LOAD 1
int g_argc;
char *g_argv[16];
-#define GS_BGCOLOUR *((vu32*)0x120000e0)
+#define GS_BGCOLOUR *((vu32*)0x120000e0)
struct _lf_elf_load_arg {
- union
- {
- u32 epc;
- int result;
- } p;
- u32 gp;
- char path[LF_PATH_MAX];
- char secname[LF_ARG_MAX];
+ union
+ {
+ u32 epc;
+ int result;
+ } p;
+ u32 gp;
+ char path[LF_PATH_MAX];
+ char secname[LF_ARG_MAX];
} __attribute__((aligned (16)));
typedef struct {
- u8 ident[16];
- u16 type;
- u16 machine;
- u32 version;
- u32 entry;
- u32 phoff;
- u32 shoff;
- u32 flags;
- u16 ehsize;
- u16 phentsize;
- u16 phnum;
- u16 shentsize;
- u16 shnum;
- u16 shstrndx;
+ u8 ident[16];
+ u16 type;
+ u16 machine;
+ u32 version;
+ u32 entry;
+ u32 phoff;
+ u32 shoff;
+ u32 flags;
+ u16 ehsize;
+ u16 phentsize;
+ u16 phnum;
+ u16 shentsize;
+ u16 shnum;
+ u16 shstrndx;
} elf_header_t;
typedef struct {
- u32 type;
- u32 offset;
- void *vaddr;
- u32 paddr;
- u32 filesz;
- u32 memsz;
- u32 flags;
- u32 align;
+ u32 type;
+ u32 offset;
+ void *vaddr;
+ u32 paddr;
+ u32 filesz;
+ u32 memsz;
+ u32 flags;
+ u32 align;
} elf_pheader_t;
/* From NetCheat */
void MyLoadElf(char *elfpath)
{
- ResetEE(0x7f);
-
- /* Clear user memory */
- int i;
- for (i = 0x00100000; i < 0x02000000; i += 64) {
- __asm__ (
- "\tsq $0, 0(%0) \n"
- "\tsq $0, 16(%0) \n"
- "\tsq $0, 32(%0) \n"
- "\tsq $0, 48(%0) \n"
- :: "r" (i)
- );
- }
-
- /* Clear scratchpad memory */
- memset((void*)0x70000000, 0, 16 * 1024);
-
- char *args[1];
- t_ExecData sifelf;
-
- memset(&sifelf, 0, sizeof(t_ExecData));
-
- elf_header_t boot_header;
- elf_pheader_t boot_pheader;
- int fd = 0;
- fioInit();
- GS_BGCOLOUR = red; /* RED: Opening elf */
- fd = fioOpen(elfpath, O_RDONLY); //Open the elf
- if (fd < 0) { fioClose(fd); return; } //If it doesn't exist, return
-
- GS_BGCOLOUR = blue;
-
- if(read(fd, &boot_header, sizeof(elf_header_t)) != sizeof(elf_header_t)) {
- close(fd);
- }
-
- GS_BGCOLOUR = white;
-
- /* check ELF magic */
- if ((*(u32*)boot_header.ident) != ELF_MAGIC) {
- close(fd);
- }
-
- /* copy loadable program segments to RAM */
- for (i = 0; i < boot_header.phnum; i++) {
- lseek(fd, boot_header.phoff+(i*sizeof(elf_pheader_t)), SEEK_SET);
- read(fd, &boot_pheader, sizeof(elf_pheader_t));
-
- if (boot_pheader.type != ELF_PT_LOAD)
- continue;
-
- lseek(fd, boot_pheader.offset, SEEK_SET);
- read(fd, boot_pheader.vaddr, boot_pheader.filesz);
-
- if (boot_pheader.memsz > boot_pheader.filesz)
- memset(boot_pheader.vaddr + boot_pheader.filesz, 0,
- boot_pheader.memsz - boot_pheader.filesz);
-
- }
-
- close(fd);
-
- // Booting part
- GS_BGCOLOUR = yellow; /* YELLOW: ExecPS2 */
-
- /* IOP reboot routine from ps2rd */
- SifInitRpc(0);
-
- while (!SifIopReset("rom0:UDNL rom0:EELOADCNF", 0))
- ;
- while (!SifIopSync())
- ;
-
- /* exit services */
- fioExit();
- SifExitIopHeap();
- SifLoadFileExit();
- SifExitRpc();
- SifExitCmd();
-
- FlushCache(0);
- FlushCache(2);
-
- args[0] = elfpath;
- ExecPS2((u32*)boot_header.entry, 0, 1, args);
+ ResetEE(0x7f);
+
+ /* Clear user memory */
+ int i;
+ for (i = 0x00100000; i < 0x02000000; i += 64) {
+ __asm__ (
+ "\tsq $0, 0(%0) \n"
+ "\tsq $0, 16(%0) \n"
+ "\tsq $0, 32(%0) \n"
+ "\tsq $0, 48(%0) \n"
+ :: "r" (i)
+ );
+ }
+
+ /* Clear scratchpad memory */
+ memset((void*)0x70000000, 0, 16 * 1024);
+
+ char *args[1];
+ t_ExecData sifelf;
+
+ memset(&sifelf, 0, sizeof(t_ExecData));
+
+ elf_header_t boot_header;
+ elf_pheader_t boot_pheader;
+ int fd = 0;
+ fioInit();
+ GS_BGCOLOUR = red; /* RED: Opening elf */
+ fd = fioOpen(elfpath, O_RDONLY); //Open the elf
+ if (fd < 0) { fioClose(fd); return; } //If it doesn't exist, return
+
+ GS_BGCOLOUR = blue;
+
+ if(read(fd, &boot_header, sizeof(elf_header_t)) != sizeof(elf_header_t)) {
+ close(fd);
+ }
+
+ GS_BGCOLOUR = white;
+
+ /* check ELF magic */
+ if ((*(u32*)boot_header.ident) != ELF_MAGIC) {
+ close(fd);
+ }
+
+ /* copy loadable program segments to RAM */
+ for (i = 0; i < boot_header.phnum; i++) {
+ lseek(fd, boot_header.phoff+(i*sizeof(elf_pheader_t)), SEEK_SET);
+ read(fd, &boot_pheader, sizeof(elf_pheader_t));
+
+ if (boot_pheader.type != ELF_PT_LOAD)
+ continue;
+
+ lseek(fd, boot_pheader.offset, SEEK_SET);
+ read(fd, boot_pheader.vaddr, boot_pheader.filesz);
+
+ if (boot_pheader.memsz > boot_pheader.filesz)
+ memset(boot_pheader.vaddr + boot_pheader.filesz, 0,
+ boot_pheader.memsz - boot_pheader.filesz);
+
+ }
+
+ close(fd);
+
+ // Booting part
+ GS_BGCOLOUR = yellow; /* YELLOW: ExecPS2 */
+
+ /* IOP reboot routine from ps2rd */
+ SifInitRpc(0);
+
+ while (!SifIopReset("rom0:UDNL rom0:EELOADCNF", 0))
+ ;
+ while (!SifIopSync())
+ ;
+
+ /* exit services */
+ fioExit();
+ SifExitIopHeap();
+ SifLoadFileExit();
+ SifExitRpc();
+ SifExitCmd();
+
+ FlushCache(0);
+ FlushCache(2);
+
+ args[0] = elfpath;
+ ExecPS2((u32*)boot_header.entry, 0, 1, args);
}
/*
@@ -167,7 +167,7 @@ argv[0] = elf path
int main(int argc, char *argv[])
{
- MyLoadElf(argv[0]);
-
- return 0;
+ MyLoadElf(argv[0]);
+
+ return 0;
}
Oops, something went wrong.

0 comments on commit ec540c0

Please sign in to comment.