mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-02-05 02:40:56 +01:00
commit
d485f17784
@ -1,64 +0,0 @@
|
|||||||
.include "asm/macros.inc"
|
|
||||||
.include "constants/constants.inc"
|
|
||||||
|
|
||||||
.syntax unified
|
|
||||||
|
|
||||||
.text
|
|
||||||
|
|
||||||
thumb_func_start sub_81700F8
|
|
||||||
sub_81700F8: @ 81700F8
|
|
||||||
push {r4,r5,lr}
|
|
||||||
ldr r5, =0x04000208
|
|
||||||
ldrh r4, [r5]
|
|
||||||
movs r0, 0
|
|
||||||
strh r0, [r5]
|
|
||||||
movs r0, 0x1
|
|
||||||
bl RegisterRamReset
|
|
||||||
movs r0, 0
|
|
||||||
movs r1, 0x80
|
|
||||||
bl ClearGpuRegBits
|
|
||||||
strh r4, [r5]
|
|
||||||
ldr r1, =gMain
|
|
||||||
ldr r0, =0x00000439
|
|
||||||
adds r1, r0
|
|
||||||
ldrb r2, [r1]
|
|
||||||
movs r0, 0x3
|
|
||||||
negs r0, r0
|
|
||||||
ands r0, r2
|
|
||||||
strb r0, [r1]
|
|
||||||
bl sub_815355C
|
|
||||||
lsls r0, 16
|
|
||||||
lsrs r0, 16
|
|
||||||
bl SetSaveBlocksPointers
|
|
||||||
bl sub_808447C
|
|
||||||
bl ResetSaveCounters
|
|
||||||
movs r0, 0
|
|
||||||
bl sub_81534D0
|
|
||||||
ldr r0, =gSaveFileStatus
|
|
||||||
ldrh r0, [r0]
|
|
||||||
cmp r0, 0
|
|
||||||
beq _08170148
|
|
||||||
cmp r0, 0x2
|
|
||||||
bne _0817014C
|
|
||||||
_08170148:
|
|
||||||
bl Sav2_ClearSetDefault
|
|
||||||
_0817014C:
|
|
||||||
ldr r0, =gSaveBlock2Ptr
|
|
||||||
ldr r0, [r0]
|
|
||||||
ldrb r0, [r0, 0x15]
|
|
||||||
lsls r0, 31
|
|
||||||
lsrs r0, 31
|
|
||||||
bl SetPokemonCryStereo
|
|
||||||
ldr r0, =0x02000000
|
|
||||||
movs r1, 0xE0
|
|
||||||
lsls r1, 9
|
|
||||||
bl InitHeap
|
|
||||||
ldr r0, =sub_8086230
|
|
||||||
bl SetMainCallback2
|
|
||||||
pop {r4,r5}
|
|
||||||
pop {r0}
|
|
||||||
bx r0
|
|
||||||
.pool
|
|
||||||
thumb_func_end sub_81700F8
|
|
||||||
|
|
||||||
.align 2, 0 @ Don't pad with nop.
|
|
15
include/gpu_regs.h
Normal file
15
include/gpu_regs.h
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
//
|
||||||
|
// Created by scott on 9/15/2017.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef GUARD_GPU_REGS_H
|
||||||
|
#define GUARD_GPU_REGS_H
|
||||||
|
|
||||||
|
// Exported type declarations
|
||||||
|
|
||||||
|
// Exported RAM declarations
|
||||||
|
|
||||||
|
// Exported ROM declarations
|
||||||
|
void ClearGpuRegBits(u8 regOffset, u16 mask);
|
||||||
|
|
||||||
|
#endif //GUARD_GPU_REGS_H
|
@ -18,5 +18,6 @@ void SaveSerializedGame(void);
|
|||||||
void LoadSerializedGame(void);
|
void LoadSerializedGame(void);
|
||||||
void LoadPlayerBag(void);
|
void LoadPlayerBag(void);
|
||||||
void SavePlayerBag(void);
|
void SavePlayerBag(void);
|
||||||
|
void SetSaveBlocksPointers(u16);
|
||||||
|
|
||||||
#endif // GUARD_LOAD_SAVE_H
|
#endif // GUARD_LOAD_SAVE_H
|
||||||
|
@ -5,8 +5,10 @@
|
|||||||
#define calloc AllocZeroed
|
#define calloc AllocZeroed
|
||||||
#define free Free
|
#define free Free
|
||||||
|
|
||||||
|
extern u8 gHeap[];
|
||||||
void *Alloc(u32 size);
|
void *Alloc(u32 size);
|
||||||
void *AllocZeroed(u32 size);
|
void *AllocZeroed(u32 size);
|
||||||
void Free(void *pointer);
|
void Free(void *pointer);
|
||||||
|
void InitHeap(void *pointer, u32 size);
|
||||||
|
|
||||||
#endif // GUARD_MALLOC_H
|
#endif // GUARD_MALLOC_H
|
||||||
|
@ -9,5 +9,7 @@ void ClearPokedexFlags(void);
|
|||||||
void WarpToTruck(void);
|
void WarpToTruck(void);
|
||||||
void NewGameInitData(void);
|
void NewGameInitData(void);
|
||||||
void ResetMiniGamesResults(void);
|
void ResetMiniGamesResults(void);
|
||||||
|
void sub_808447C(void);
|
||||||
|
void Sav2_ClearSetDefault(void);
|
||||||
|
|
||||||
#endif // GUARD_NEW_GAME_H
|
#endif // GUARD_NEW_GAME_H
|
||||||
|
@ -27,5 +27,6 @@ extern struct LinkPlayerMapObject gLinkPlayerMapObjects[4];
|
|||||||
void strange_npc_table_clear(void);
|
void strange_npc_table_clear(void);
|
||||||
const struct MapHeader *get_mapheader_by_bank_and_number(u8, u8);
|
const struct MapHeader *get_mapheader_by_bank_and_number(u8, u8);
|
||||||
void FieldObjectMoveDestCoords(struct MapObject *, u32, s16 *, s16 *);
|
void FieldObjectMoveDestCoords(struct MapObject *, u32, s16 *, s16 *);
|
||||||
|
void sub_8086230(void);
|
||||||
|
|
||||||
#endif //GUARD_ROM4_H
|
#endif //GUARD_ROM4_H
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#ifndef GUARD_SAVE_H
|
#ifndef GUARD_SAVE_H
|
||||||
#define GUARD_SAVE_H
|
#define GUARD_SAVE_H
|
||||||
|
|
||||||
|
extern u16 gSaveFileStatus;
|
||||||
|
|
||||||
struct SaveSectionLocation
|
struct SaveSectionLocation
|
||||||
{
|
{
|
||||||
void *data;
|
void *data;
|
||||||
@ -88,5 +90,7 @@ u16 CalculateChecksum(void *, u16);
|
|||||||
//u8 unref_sub_8125FF0(u8 *data, u16 size);
|
//u8 unref_sub_8125FF0(u8 *data, u16 size);
|
||||||
//u8 unref_sub_8126068(u8 sector, u8 *data, u32 size);
|
//u8 unref_sub_8126068(u8 sector, u8 *data, u32 size);
|
||||||
//u8 unref_sub_8126080(u8 sector, u8 *data);
|
//u8 unref_sub_8126080(u8 sector, u8 *data);
|
||||||
|
u16 sub_815355C(void);
|
||||||
|
u8 sub_81534D0(u8);
|
||||||
|
|
||||||
#endif // GUARD_SAVE_H
|
#endif // GUARD_SAVE_H
|
||||||
|
@ -217,7 +217,7 @@ SECTIONS {
|
|||||||
asm/battle_controller_wally.o(.text);
|
asm/battle_controller_wally.o(.text);
|
||||||
asm/player_pc.o(.text);
|
asm/player_pc.o(.text);
|
||||||
asm/intro.o(.text);
|
asm/intro.o(.text);
|
||||||
asm/reset_save_heap.o(.text);
|
src/reset_save_heap.o(.text);
|
||||||
asm/field_region_map.o(.text);
|
asm/field_region_map.o(.text);
|
||||||
asm/battle_anim_8170478.o(.text);
|
asm/battle_anim_8170478.o(.text);
|
||||||
asm/hall_of_fame.o(.text);
|
asm/hall_of_fame.o(.text);
|
||||||
|
@ -6,15 +6,11 @@
|
|||||||
#include "rng.h"
|
#include "rng.h"
|
||||||
#include "malloc.h"
|
#include "malloc.h"
|
||||||
|
|
||||||
extern u8 gPlayerPartyCount;
|
|
||||||
extern struct PokemonStorage* gPokemonStoragePtr;
|
|
||||||
extern void* gUnknown_0203CF5C;
|
extern void* gUnknown_0203CF5C;
|
||||||
extern u8 gHeap[0x1C000];
|
|
||||||
|
|
||||||
extern bool16 IdentifyFlash(void);
|
extern bool16 IdentifyFlash(void);
|
||||||
extern void SetBagItemsPointers(void);
|
extern void SetBagItemsPointers(void);
|
||||||
extern void SetDecorationInventoriesPointers(void);
|
extern void SetDecorationInventoriesPointers(void);
|
||||||
extern void InitHeap(void *heapStart, u32 heapSize);
|
|
||||||
|
|
||||||
void ApplyNewEncyprtionKeyToAllEncryptedData(u32 encryptionKey);
|
void ApplyNewEncyprtionKeyToAllEncryptedData(u32 encryptionKey);
|
||||||
|
|
||||||
|
32
src/reset_save_heap.c
Normal file
32
src/reset_save_heap.c
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
#include "global.h"
|
||||||
|
#include "main.h"
|
||||||
|
#include "gpu_regs.h"
|
||||||
|
#include "m4a.h"
|
||||||
|
#include "load_save.h"
|
||||||
|
#include "save.h"
|
||||||
|
#include "new_game.h"
|
||||||
|
#include "rom4.h"
|
||||||
|
#include "malloc.h"
|
||||||
|
|
||||||
|
void sub_81700F8(void)
|
||||||
|
{
|
||||||
|
u16 imeBackup;
|
||||||
|
|
||||||
|
imeBackup = REG_IME;
|
||||||
|
REG_IME = 0;
|
||||||
|
RegisterRamReset(0x00000001);
|
||||||
|
ClearGpuRegBits(REG_OFFSET_DISPCNT, 0x80);
|
||||||
|
REG_IME = imeBackup;
|
||||||
|
gMain.inBattle = FALSE;
|
||||||
|
SetSaveBlocksPointers(sub_815355C());
|
||||||
|
sub_808447C();
|
||||||
|
ResetSaveCounters();
|
||||||
|
sub_81534D0(0);
|
||||||
|
if (gSaveFileStatus == 0 || gSaveFileStatus == 2)
|
||||||
|
{
|
||||||
|
Sav2_ClearSetDefault();
|
||||||
|
}
|
||||||
|
SetPokemonCryStereo(gSaveBlock2Ptr->optionsSound);
|
||||||
|
InitHeap(gHeap, 0x1c000);
|
||||||
|
SetMainCallback2(sub_8086230);
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user