Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "include/gba.h"
- #include "useful.h"
- #include "img_bins/sprites.h"
- #include "img_bins/workaround.c"
- #include "img_bins/ui.c"
- #include "img_bins/empty.c"
- #define DMA3Source (*(u32 *) 0x040000D4)
- #define DMA3Dest (*(u32 *) 0x040000D8)
- #define DMA3Options (*(u32 *) 0x040000DC)
- #define Tiles ((u16 *) 0x6008000)
- #define Tiles2 ((u16 *) 0x6000000)
- #define MapData ((u16 *) 0x600E800)
- #define BG0Data ((u16 *) 0x600E800)
- #define BG2Data ((u16 *) 0x600E000)
- #define BG3Data ((u16 *) 0x600F000)
- #define OBJData ((u16 *) 0x6010000)
- #define MenuBG ((u16 *) 0x600F800)
- #define waitasec (65535*2)
- void GetInput();
- #define currentLoop (*(u8 *) (globalVars + 0x0))//helps in main since ya know
- #define lastKeyPress (*(u8 *) (globalVars + 0x1))//helps so we know that they're done pressing
- #define currentpocket (*(u8 *) (globalVars + 0x2))
- #define dirtomove (*(u8 *) (globalVars + 0x3))//lets me know where I'm moving next. 0,1,2 for none, left, right.
- #define stuffthree (*(u8 *) (globalVars + 0x4))
- #define unused_one (*(u8 *) (globalVars + 0x5))
- #define unused_two (*(u8 *) (globalVars + 0x6))
- #define unused_three (*(u8 *) (globalVars + 0x7))
- #define unused_four (*(u8 *) (globalVars + 0x8))
- #define unused_five (*(u8 *) (globalVars + 0x9))
- #define unused_six (*(u8 *) (globalVars + 0xA))
- #define unused_seven (*(u8 *) (globalVars + 0xB))
- #define unused_eight (*(u8 *) (globalVars + 0xC))
- #define unused_nine (*(u16 *) (globalVars + 0xD))
- #define unused_ten (*(u16 *) (globalVars + 0xF))
- #define unused_eleven (*(u16 *) (globalVars + 0x11))
- //original bag routine at 0x0806F481
- void init2();
- void init3();
- void main();
- void init() {
- storeCallback((void *) init2 + 1);
- }
- #include "include/gba_compress.h"
- #include "useful-bpre.h"
- void init2() {
- storeCallback2(0);
- globalVars = malloc(0x80);
- int blank = 0;
- DMA3Source = ␣
- DMA3Dest = globalVars;
- DMA3Options = 0x81000040;
- currentLoop = 0;
- currentpocket = 0;
- storeCallback((void *) init3 + 1);
- }
- void init3() {
- for(int i=0x10;i<0x20;i+=2) changeIO(i,0);
- initStuff();
- const u32 mapDataUnk[2] = {
- 0x000001E0, 0x000011D9
- };
- initMapData(0x1,mapDataUnk,0x2);
- storeCallback((void *) main + 1);
- LASTRESULT = 0xFF;
- }
- void main()
- {
- if (currentLoop == 0)
- {
- dirtomove = 0;
- initVideo();
- initBG();
- clearOAM();
- unfadeScreen();
- currentLoop++;
- storeCallback2((void *) updateEverything2 + 1);
- }
- else if (currentLoop == 1)
- {
- if (fadeScreenDone == 0)
- currentLoop++;
- }
- else if (currentLoop == 2)
- {
- GetInput();
- }
- else if (currentLoop == 3)//exiting function
- {
- if (fadeScreenDone == 0)
- someExitFunc();
- }
- updateEverything();
- }
- void GetInput()
- {
- if(keyPressed(KEY_LEFT) && currentpocket != 0)
- {
- dirtomove = 1;
- }
- else if(keyPressed(KEY_RIGHT) && currentpocket != 2)
- {
- dirtomove = 2;
- }
- else if(keyPressed(KEY_A))
- {
- yesNoBox();
- }
- else if(keyPressed(KEY_B))
- {
- fadeScreen();
- storeCallback(nullCallback);
- if (globalVars != 0)
- {
- free(globalVars);
- globalVars = 0;
- }
- currentLoop = 3;
- }
- }
- void initVideo() {
- changeIO(0,OBJ_ENABLE | OBJ_MAP_1D);
- u32 x = 0x80 << 5;
- u32 endAddr = 0xC0 << 0x13;
- int blank = 0;
- for(u32 i = 0xC0 << 9; i > x ; i -= x, endAddr += x) {
- DMA3Source = ␣
- DMA3Dest = endAddr;
- DMA3Options = 0x81000800;
- }
- textboxBGInit(boxInitStuff);
- enableBG(0);
- enableBG(1);
- enableBG(3);
- changeIO(0x4, 0x1E08);
- changeIO(0x6, 0x1C46);
- changeIO(0x8,(0x1E << SCREEN_SHIFT));
- changeIO(0xA,(0x1D << SCREEN_SHIFT) | (2 << CHAR_SHIFT) | 3);
- changeIO(0,0x3740);
- }
- void loaditem(){
- u32* loc = (u32*)0x0203988C;
- u8* itemdataPointer = (u8*)loc[0];
- u16 item = itemdataPointer[0];
- u8 itemamount = itemdataPointer[2];
- }
- void initBG(){
- LZ77UnCompVram(uiTiles,Tiles-0x4000);
- LZ77UnCompVram(uiMap, BG2Data);
- copyPal(uiPal,0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement