mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 03:34:15 +01:00
Merge remote-tracking branch 'pret/master'
This commit is contained in:
commit
73d3a21c2d
@ -12,8 +12,8 @@ btintgfxdir := graphics/battle_interface
|
||||
masksgfxdir := graphics/battle_anims/masks
|
||||
bttransgfxdir := graphics/battle_transitions
|
||||
typesdir := graphics/types
|
||||
raydir := graphics/rayquaza_scene
|
||||
roulgfxdir := graphics/roulette
|
||||
rayquazadir := graphics/rayquaza_scene
|
||||
roulettegfxdir := graphics/roulette
|
||||
pknvdir := graphics/pokenav/
|
||||
pknvoptionsdir := graphics/pokenav/options
|
||||
|
||||
@ -308,101 +308,138 @@ graphics/pokenav/region_map.8bpp: %.8bpp: %.png
|
||||
graphics/misc/japanese_hof.4bpp: %.4bpp: %.png
|
||||
$(GFX) $< $@ -num_tiles 29
|
||||
|
||||
$(menudir)/menu.gbapal: $(menudir)/menu_0.gbapal $(menudir)/menu_1.gbapal
|
||||
@cat $(menudir)/menu_0.gbapal $(menudir)/menu_1.gbapal >$@
|
||||
$(menudir)/menu.gbapal: $(menudir)/menu_0.gbapal \
|
||||
$(menudir)/menu_1.gbapal
|
||||
@cat $^ >$@
|
||||
|
||||
$(btanimgfxdir)/010.4bpp: $(btanimgfxdir)/010_0.4bpp $(btanimgfxdir)/010_1.4bpp $(btanimgfxdir)/010_2.4bpp $(btanimgfxdir)/010_3.4bpp
|
||||
@cat $(btanimgfxdir)/010_0.4bpp $(btanimgfxdir)/010_1.4bpp $(btanimgfxdir)/010_2.4bpp $(btanimgfxdir)/010_3.4bpp >$@
|
||||
$(btanimgfxdir)/010.4bpp: $(btanimgfxdir)/010_0.4bpp \
|
||||
$(btanimgfxdir)/010_1.4bpp \
|
||||
$(btanimgfxdir)/010_2.4bpp \
|
||||
$(btanimgfxdir)/010_3.4bpp
|
||||
@cat $^ >$@
|
||||
|
||||
$(unusedgfxdir)/obi_palpak1.gbapal: $(unusedgfxdir)/old_pal1.gbapal $(unusedgfxdir)/old_pal2.gbapal $(unusedgfxdir)/old_pal3.gbapal
|
||||
@cat $(unusedgfxdir)/old_pal1.gbapal $(unusedgfxdir)/old_pal2.gbapal $(unusedgfxdir)/old_pal3.gbapal >$@
|
||||
$(unusedgfxdir)/obi_palpak1.gbapal: $(unusedgfxdir)/old_pal1.gbapal \
|
||||
$(unusedgfxdir)/old_pal2.gbapal \
|
||||
$(unusedgfxdir)/old_pal3.gbapal
|
||||
@cat $^ >$@
|
||||
|
||||
$(unusedgfxdir)/obi_palpak3.gbapal: $(unusedgfxdir)/old_pal5.gbapal $(unusedgfxdir)/old_pal6.gbapal $(unusedgfxdir)/old_pal7.gbapal
|
||||
@cat $(unusedgfxdir)/old_pal5.gbapal $(unusedgfxdir)/old_pal6.gbapal $(unusedgfxdir)/old_pal7.gbapal >$@
|
||||
$(unusedgfxdir)/obi_palpak3.gbapal: $(unusedgfxdir)/old_pal5.gbapal \
|
||||
$(unusedgfxdir)/old_pal6.gbapal \
|
||||
$(unusedgfxdir)/old_pal7.gbapal
|
||||
@cat $^ >$@
|
||||
|
||||
$(unusedgfxdir)/obi1.4bpp: $(unusedgfxdir)/old_bulbasaur.4bpp $(unusedgfxdir)/old_charizard.4bpp
|
||||
@cat $(unusedgfxdir)/old_bulbasaur.4bpp $(unusedgfxdir)/old_charizard.4bpp >$@
|
||||
$(unusedgfxdir)/obi1.4bpp: $(unusedgfxdir)/old_bulbasaur.4bpp \
|
||||
$(unusedgfxdir)/old_charizard.4bpp
|
||||
@cat $^ >$@
|
||||
|
||||
$(unusedgfxdir)/obi2.4bpp: $(unusedgfxdir)/old_bulbasaur2.4bpp $(unusedgfxdir)/old_battle_interface_1.4bpp $(unusedgfxdir)/old_battle_interface_2.4bpp $(unusedgfxdir)/old_battle_interface_3.4bpp
|
||||
@cat $(unusedgfxdir)/old_bulbasaur2.4bpp $(unusedgfxdir)/old_battle_interface_1.4bpp $(unusedgfxdir)/old_battle_interface_2.4bpp $(unusedgfxdir)/old_battle_interface_3.4bpp >$@
|
||||
$(unusedgfxdir)/obi2.4bpp: $(unusedgfxdir)/old_bulbasaur2.4bpp \
|
||||
$(unusedgfxdir)/old_battle_interface_1.4bpp \
|
||||
$(unusedgfxdir)/old_battle_interface_2.4bpp \
|
||||
$(unusedgfxdir)/old_battle_interface_3.4bpp
|
||||
@cat $^ >$@
|
||||
|
||||
$(menudir)/hp_numbers.4bpp: $(menudir)/hpbar_anim.4bpp $(menudir)/numbers1.4bpp $(menudir)/numbers2.4bpp
|
||||
@cat $(menudir)/hpbar_anim.4bpp $(menudir)/numbers1.4bpp $(menudir)/numbers2.4bpp >$@
|
||||
$(menudir)/hp_numbers.4bpp: $(menudir)/hpbar_anim.4bpp \
|
||||
$(menudir)/numbers1.4bpp \
|
||||
$(menudir)/numbers2.4bpp
|
||||
@cat $^ >$@
|
||||
|
||||
$(unusedgfxdir)/redyellowgreen_frame.bin: $(unusedgfxdir)/red_frame.bin $(unusedgfxdir)/yellow_frame.bin $(unusedgfxdir)/green_frame.bin $(unusedgfxdir)/blank_frame.bin
|
||||
@cat $(unusedgfxdir)/red_frame.bin $(unusedgfxdir)/yellow_frame.bin $(unusedgfxdir)/green_frame.bin $(unusedgfxdir)/blank_frame.bin >$@
|
||||
$(unusedgfxdir)/redyellowgreen_frame.bin: $(unusedgfxdir)/red_frame.bin \
|
||||
$(unusedgfxdir)/yellow_frame.bin \
|
||||
$(unusedgfxdir)/green_frame.bin \
|
||||
$(unusedgfxdir)/blank_frame.bin
|
||||
@cat $^ >$@
|
||||
|
||||
$(unusedgfxdir)/color_frames.4bpp: $(unusedgfxdir)/color_frames.png
|
||||
$(unusedgfxdir)/color_frames.4bpp: %.4bpp: %.png
|
||||
$(GFX) $< $@ -num_tiles 353
|
||||
|
||||
$(btintgfxdir)/unused_window2bar.4bpp: $(btintgfxdir)/unused_window2bar.png
|
||||
$(btintgfxdir)/unused_window2bar.4bpp: %.4bpp: %.png
|
||||
$(GFX) $< $@ -num_tiles 5
|
||||
|
||||
$(unusedgfxdir)/old_contest.4bpp: $(unusedgfxdir)/old_contest_frame_1.4bpp $(unusedgfxdir)/old_contest_floor.4bpp $(unusedgfxdir)/old_contest_frame_2.4bpp $(unusedgfxdir)/old_contest_symbols.4bpp $(unusedgfxdir)/old_contest_meter.4bpp $(unusedgfxdir)/old_contest_classes.4bpp $(unusedgfxdir)/old_contest_numbers.4bpp
|
||||
@cat $(unusedgfxdir)/old_contest_frame_1.4bpp $(unusedgfxdir)/old_contest_floor.4bpp $(unusedgfxdir)/old_contest_frame_2.4bpp $(unusedgfxdir)/old_contest_symbols.4bpp $(unusedgfxdir)/old_contest_meter.4bpp $(unusedgfxdir)/old_contest_classes.4bpp $(unusedgfxdir)/old_contest_numbers.4bpp >$@
|
||||
$(unusedgfxdir)/old_contest.4bpp: $(unusedgfxdir)/old_contest_frame_1.4bpp \
|
||||
$(unusedgfxdir)/old_contest_floor.4bpp \
|
||||
$(unusedgfxdir)/old_contest_frame_2.4bpp \
|
||||
$(unusedgfxdir)/old_contest_symbols.4bpp \
|
||||
$(unusedgfxdir)/old_contest_meter.4bpp \
|
||||
$(unusedgfxdir)/old_contest_classes.4bpp \
|
||||
$(unusedgfxdir)/old_contest_numbers.4bpp
|
||||
@cat $^ >$@
|
||||
|
||||
$(unusedgfxdir)/old_contest_2.4bpp: $(unusedgfxdir)/old_contest_2_1.4bpp $(unusedgfxdir)/old_contest_2_2.4bpp
|
||||
@cat $(unusedgfxdir)/old_contest_2_1.4bpp $(unusedgfxdir)/old_contest_2_2.4bpp >$@
|
||||
$(unusedgfxdir)/old_contest_2.4bpp: $(unusedgfxdir)/old_contest_2_1.4bpp \
|
||||
$(unusedgfxdir)/old_contest_2_2.4bpp
|
||||
@cat $^ >$@
|
||||
|
||||
$(unknowngfxdir)/unknown_C19470.4bpp: $(unknowngfxdir)/unknown_C19470.png
|
||||
$(unknowngfxdir)/unknown_C19470.4bpp: %.4bpp: %.png
|
||||
$(GFX) $< $@ -num_tiles 36
|
||||
|
||||
$(btanimgfxdir)/141.4bpp: $(btanimgfxdir)/141_0.4bpp $(btanimgfxdir)/141_1.4bpp $(btanimgfxdir)/141_2.4bpp $(btanimgfxdir)/141_3.4bpp $(btanimgfxdir)/141_4.4bpp
|
||||
@cat $(btanimgfxdir)/141_0.4bpp $(btanimgfxdir)/141_1.4bpp $(btanimgfxdir)/141_2.4bpp $(btanimgfxdir)/141_3.4bpp $(btanimgfxdir)/141_4.4bpp >$@
|
||||
$(btanimgfxdir)/141.4bpp: $(btanimgfxdir)/141_0.4bpp \
|
||||
$(btanimgfxdir)/141_1.4bpp \
|
||||
$(btanimgfxdir)/141_2.4bpp \
|
||||
$(btanimgfxdir)/141_3.4bpp \
|
||||
$(btanimgfxdir)/141_4.4bpp
|
||||
@cat $^ >$@
|
||||
|
||||
$(btanimgfxdir)/074.4bpp: $(btanimgfxdir)/074_0.4bpp $(btanimgfxdir)/074_1.4bpp
|
||||
@cat $(btanimgfxdir)/074_0.4bpp $(btanimgfxdir)/074_1.4bpp >$@
|
||||
$(btanimgfxdir)/074.4bpp: $(btanimgfxdir)/074_0.4bpp \
|
||||
$(btanimgfxdir)/074_1.4bpp
|
||||
@cat $^ >$@
|
||||
|
||||
$(btanimgfxdir)/159.4bpp: $(btanimgfxdir)/159_0.4bpp $(btanimgfxdir)/159_1.4bpp
|
||||
@cat $(btanimgfxdir)/159_0.4bpp $(btanimgfxdir)/159_1.4bpp >$@
|
||||
$(btanimgfxdir)/159.4bpp: $(btanimgfxdir)/159_0.4bpp \
|
||||
$(btanimgfxdir)/159_1.4bpp
|
||||
@cat $^ >$@
|
||||
|
||||
$(btanimgfxdir)/001.4bpp: $(btanimgfxdir)/001_0.4bpp $(btanimgfxdir)/001_1.4bpp
|
||||
@cat $(btanimgfxdir)/001_0.4bpp $(btanimgfxdir)/001_1.4bpp >$@
|
||||
$(btanimgfxdir)/001.4bpp: $(btanimgfxdir)/001_0.4bpp \
|
||||
$(btanimgfxdir)/001_1.4bpp
|
||||
@cat $^ >$@
|
||||
|
||||
$(masksgfxdir)/unknown_C2EA50.4bpp: $(masksgfxdir)/unknown_C2EA50.png
|
||||
$(masksgfxdir)/unknown_C2EA50.4bpp: %.4bpp: %.png
|
||||
$(GFX) $< $@ -num_tiles 14
|
||||
|
||||
$(bttransgfxdir)/vs_frame.4bpp: $(bttransgfxdir)/vs_frame.png
|
||||
$(bttransgfxdir)/vs_frame.4bpp: %.4bpp: %.png
|
||||
$(GFX) $< $@ -num_tiles 16
|
||||
|
||||
$(menudir)/party_menu_misc.4bpp: $(menudir)/party_menu_misc.png
|
||||
$(menudir)/party_menu_misc.4bpp: %.4bpp: %.png
|
||||
$(GFX) $< $@ -num_tiles 62
|
||||
|
||||
$(typesdir)/move_types.4bpp: $(types:%=$(typesdir)/%.4bpp) $(contest_types:%=$(typesdir)/contest_%.4bpp)
|
||||
@cat $^ >$@
|
||||
|
||||
$(typesdir)/move_types.gbapal: $(typesdir)/move_types_1.gbapal $(typesdir)/move_types_2.gbapal $(typesdir)/move_types_3.gbapal
|
||||
@cat $(typesdir)/move_types_1.gbapal $(typesdir)/move_types_2.gbapal $(typesdir)/move_types_3.gbapal >$@
|
||||
$(typesdir)/move_types.gbapal: $(typesdir)/move_types_1.gbapal \
|
||||
$(typesdir)/move_types_2.gbapal \
|
||||
$(typesdir)/move_types_3.gbapal
|
||||
@cat $^ >$@
|
||||
|
||||
$(menudir)/bag_screen.4bpp: $(menudir)/bag_screen.png
|
||||
$(menudir)/bag_screen.4bpp: %.4bpp: %.png
|
||||
$(GFX) $< $@ -num_tiles 53
|
||||
|
||||
$(raydir)/rayquaza.8bpp: $(raydir)/rayquaza.png
|
||||
$(rayquazadir)/rayquaza.8bpp: %.8bpp: %.png
|
||||
$(GFX) $< $@ -num_tiles 227
|
||||
|
||||
$(raydir)/overcast.4bpp: $(raydir)/overcast.png
|
||||
$(rayquazadir)/overcast.4bpp: %.4bpp: %.png
|
||||
$(GFX) $< $@ -num_tiles 313
|
||||
|
||||
$(raydir)/rayquaza_fly1.4bpp: $(raydir)/rayquaza_fly1.png
|
||||
$(rayquazadir)/rayquaza_fly1.4bpp: %.4bpp: %.png
|
||||
$(GFX) $< $@ -num_tiles 124
|
||||
|
||||
$(raydir)/rayquaza_tail_fix.4bpp: $(raydir)/rayquaza_tail.4bpp
|
||||
$(rayquazadir)/rayquaza_tail_fix.4bpp: $(rayquazadir)/rayquaza_tail.4bpp
|
||||
cp $< $@
|
||||
head -c 12 /dev/zero >> $@
|
||||
|
||||
$(raydir)/chase_streaks.4bpp: $(raydir)/chase_streaks.png
|
||||
$(rayquazadir)/chase_streaks.4bpp: %.4bpp: %.png
|
||||
$(GFX) $< $@ -num_tiles 19
|
||||
|
||||
$(raydir)/rayquaza_chase.4bpp: $(raydir)/rayquaza_chase.png
|
||||
$(rayquazadir)/rayquaza_chase.4bpp: %.4bpp: %.png
|
||||
$(GFX) $< $@ -num_tiles 155
|
||||
|
||||
graphics/picture_frame/frame5.4bpp: %.4bpp: %.png
|
||||
$(GFX) $< $@ -num_tiles 86
|
||||
|
||||
$(roulgfxdir)/roulette_tilt.4bpp: $(roulgfxdir)/shroomish.4bpp $(roulgfxdir)/tailow.4bpp
|
||||
@cat $(roulgfxdir)/shroomish.4bpp $(roulgfxdir)/tailow.4bpp >$@
|
||||
$(roulettegfxdir)/roulette_tilt.4bpp: $(roulettegfxdir)/shroomish.4bpp \
|
||||
$(roulettegfxdir)/tailow.4bpp
|
||||
@cat $^ >$@
|
||||
|
||||
$(roulgfxdir)/poke_icons2.4bpp: $(roulgfxdir)/wynaut.4bpp $(roulgfxdir)/azurill.4bpp $(roulgfxdir)/skitty.4bpp $(roulgfxdir)/makuhita.4bpp
|
||||
$(roulettegfxdir)/poke_icons2.4bpp: $(roulettegfxdir)/wynaut.4bpp \
|
||||
$(roulettegfxdir)/azurill.4bpp \
|
||||
$(roulettegfxdir)/skitty.4bpp \
|
||||
$(roulettegfxdir)/makuhita.4bpp
|
||||
@cat $^ >$@
|
||||
|
||||
$(bttransgfxdir)/85BBC14.4bpp: %.4bpp: %.png
|
||||
@ -411,20 +448,36 @@ $(bttransgfxdir)/85BBC14.4bpp: %.4bpp: %.png
|
||||
$(bttransgfxdir)/rayquaza.4bpp: %.4bpp: %.png
|
||||
$(GFX) $< $@ -num_tiles 938
|
||||
|
||||
$(bttransgfxdir)/frontier_square_1.4bpp: $(bttransgfxdir)/frontier_squares_blanktiles.4bpp $(bttransgfxdir)/frontier_squares_1.4bpp
|
||||
$(bttransgfxdir)/frontier_square_1.4bpp: $(bttransgfxdir)/frontier_squares_blanktiles.4bpp \
|
||||
$(bttransgfxdir)/frontier_squares_1.4bpp
|
||||
@cat $^ >$@
|
||||
|
||||
$(bttransgfxdir)/frontier_square_2.4bpp: $(bttransgfxdir)/frontier_squares_blanktiles.4bpp $(bttransgfxdir)/frontier_squares_2.4bpp
|
||||
$(bttransgfxdir)/frontier_square_2.4bpp: $(bttransgfxdir)/frontier_squares_blanktiles.4bpp \
|
||||
$(bttransgfxdir)/frontier_squares_2.4bpp
|
||||
@cat $^ >$@
|
||||
|
||||
$(bttransgfxdir)/frontier_square_3.4bpp: $(bttransgfxdir)/frontier_squares_blanktiles.4bpp $(bttransgfxdir)/frontier_squares_3.4bpp
|
||||
$(bttransgfxdir)/frontier_square_3.4bpp: $(bttransgfxdir)/frontier_squares_blanktiles.4bpp \
|
||||
$(bttransgfxdir)/frontier_squares_3.4bpp
|
||||
@cat $^ >$@
|
||||
|
||||
$(bttransgfxdir)/frontier_square_4.4bpp: $(bttransgfxdir)/frontier_squares_blanktiles.4bpp $(bttransgfxdir)/frontier_squares_4.4bpp
|
||||
$(bttransgfxdir)/frontier_square_4.4bpp: $(bttransgfxdir)/frontier_squares_blanktiles.4bpp \
|
||||
$(bttransgfxdir)/frontier_squares_4.4bpp
|
||||
@cat $^ >$@
|
||||
|
||||
$(pknvoptionsdir)/options.4bpp: $(pknvoptionsdir)/hoenn_map.4bpp $(pknvoptionsdir)/condition.4bpp $(pknvoptionsdir)/match_call.4bpp $(pknvoptionsdir)/ribbons.4bpp $(pknvoptionsdir)/switch_off.4bpp $(pknvoptionsdir)/party.4bpp $(pknvoptionsdir)/search.4bpp $(pknvoptionsdir)/cool.4bpp $(pknvoptionsdir)/beauty.4bpp $(pknvoptionsdir)/cute.4bpp $(pknvoptionsdir)/smart.4bpp $(pknvoptionsdir)/tough.4bpp $(pknvoptionsdir)/cancel.4bpp
|
||||
$(pknvoptionsdir)/options.4bpp: $(pknvoptionsdir)/hoenn_map.4bpp \
|
||||
$(pknvoptionsdir)/condition.4bpp \
|
||||
$(pknvoptionsdir)/match_call.4bpp \
|
||||
$(pknvoptionsdir)/ribbons.4bpp \
|
||||
$(pknvoptionsdir)/switch_off.4bpp \
|
||||
$(pknvoptionsdir)/party.4bpp \
|
||||
$(pknvoptionsdir)/search.4bpp \
|
||||
$(pknvoptionsdir)/cool.4bpp \
|
||||
$(pknvoptionsdir)/beauty.4bpp \
|
||||
$(pknvoptionsdir)/cute.4bpp \
|
||||
$(pknvoptionsdir)/smart.4bpp \
|
||||
$(pknvoptionsdir)/tough.4bpp \
|
||||
$(pknvoptionsdir)/cancel.4bpp
|
||||
@cat $^ >$@
|
||||
|
||||
$(pknvdir)/header.4bpp: $(pknvdir)/header.png
|
||||
$(pknvdir)/header.4bpp: %.4bpp: %.png
|
||||
$(GFX) $< $@ -num_tiles 53
|
||||
|
@ -3,8 +3,8 @@
|
||||
|
||||
void ClearDma3Requests(void);
|
||||
void ProcessDma3Requests(void);
|
||||
int RequestDma3Copy(const void *src, void *dest, u16 size, u8 mode);
|
||||
int RequestDma3Fill(s32 value, void *dest, u16 size, u8 mode);
|
||||
s16 RequestDma3Copy(const void *src, void *dest, u16 size, u8 mode);
|
||||
s16 RequestDma3Fill(s32 value, void *dest, u16 size, u8 mode);
|
||||
int CheckForSpaceForDma3Request(s16 index);
|
||||
|
||||
#endif // GUARD_DMA3_H
|
||||
|
@ -1,13 +1,24 @@
|
||||
#include "global.h"
|
||||
#include "dma3.h"
|
||||
|
||||
IWRAM_DATA struct {
|
||||
/* 0x00 */ const u8 *src;
|
||||
/* 0x04 */ u8 *dest;
|
||||
/* 0x08 */ u16 size;
|
||||
/* 0x0A */ u16 mode;
|
||||
/* 0x0C */ u32 value;
|
||||
} gDma3Requests[128];
|
||||
// Maximum amount of data we will transfer in one operation
|
||||
#define MAX_DMA_BLOCK_SIZE 0x1000
|
||||
|
||||
#define MAX_DMA_REQUESTS 128
|
||||
|
||||
#define DMA_REQUEST_COPY32 1
|
||||
#define DMA_REQUEST_FILL32 2
|
||||
#define DMA_REQUEST_COPY16 3
|
||||
#define DMA_REQUEST_FILL16 4
|
||||
|
||||
IWRAM_DATA struct
|
||||
{
|
||||
const u8 *src;
|
||||
u8 *dest;
|
||||
u16 size;
|
||||
u16 mode;
|
||||
u32 value;
|
||||
} gDma3Requests[MAX_DMA_REQUESTS];
|
||||
|
||||
static bool8 gDma3ManagerLocked;
|
||||
static u8 gDma3RequestCursor;
|
||||
@ -19,19 +30,16 @@ void ClearDma3Requests(void)
|
||||
gDma3ManagerLocked = TRUE;
|
||||
gDma3RequestCursor = 0;
|
||||
|
||||
for(i = 0; i < (u8)ARRAY_COUNT(gDma3Requests); i++)
|
||||
for (i = 0; i < MAX_DMA_REQUESTS; i++)
|
||||
{
|
||||
gDma3Requests[i].size = 0;
|
||||
gDma3Requests[i].src = 0;
|
||||
gDma3Requests[i].dest = 0;
|
||||
gDma3Requests[i].src = NULL;
|
||||
gDma3Requests[i].dest = NULL;
|
||||
}
|
||||
|
||||
gDma3ManagerLocked = FALSE;
|
||||
}
|
||||
|
||||
// Maximum amount of data will will transfer in one operation
|
||||
#define DMA_MAX_BLOCK_SIZE 0x1000
|
||||
|
||||
#define Dma3CopyLarge_(src, dest, size, bit) \
|
||||
{ \
|
||||
const void *_src = src; \
|
||||
@ -39,15 +47,15 @@ void ClearDma3Requests(void)
|
||||
u32 _size = size; \
|
||||
while (1) \
|
||||
{ \
|
||||
if (_size <= DMA_MAX_BLOCK_SIZE) \
|
||||
if (_size <= MAX_DMA_BLOCK_SIZE) \
|
||||
{ \
|
||||
DmaCopy##bit(3, _src, _dest, _size); \
|
||||
break; \
|
||||
} \
|
||||
DmaCopy##bit(3, _src, _dest, DMA_MAX_BLOCK_SIZE); \
|
||||
_src += DMA_MAX_BLOCK_SIZE; \
|
||||
_dest += DMA_MAX_BLOCK_SIZE; \
|
||||
_size -= DMA_MAX_BLOCK_SIZE; \
|
||||
DmaCopy##bit(3, _src, _dest, MAX_DMA_BLOCK_SIZE); \
|
||||
_src += MAX_DMA_BLOCK_SIZE; \
|
||||
_dest += MAX_DMA_BLOCK_SIZE; \
|
||||
_size -= MAX_DMA_BLOCK_SIZE; \
|
||||
} \
|
||||
}
|
||||
|
||||
@ -60,14 +68,14 @@ void ClearDma3Requests(void)
|
||||
u32 _size = size; \
|
||||
while (1) \
|
||||
{ \
|
||||
if (_size <= DMA_MAX_BLOCK_SIZE) \
|
||||
if (_size <= MAX_DMA_BLOCK_SIZE) \
|
||||
{ \
|
||||
DmaFill##bit(3, value, _dest, _size); \
|
||||
break; \
|
||||
} \
|
||||
DmaFill##bit(3, value, _dest, DMA_MAX_BLOCK_SIZE); \
|
||||
_dest += DMA_MAX_BLOCK_SIZE; \
|
||||
_size -= DMA_MAX_BLOCK_SIZE; \
|
||||
DmaFill##bit(3, value, _dest, MAX_DMA_BLOCK_SIZE); \
|
||||
_dest += MAX_DMA_BLOCK_SIZE; \
|
||||
_size -= MAX_DMA_BLOCK_SIZE; \
|
||||
} \
|
||||
}
|
||||
|
||||
@ -77,46 +85,48 @@ void ClearDma3Requests(void)
|
||||
|
||||
void ProcessDma3Requests(void)
|
||||
{
|
||||
u16 totalSize;
|
||||
u16 bytesTransferred;
|
||||
|
||||
if (gDma3ManagerLocked)
|
||||
return;
|
||||
|
||||
totalSize = 0;
|
||||
bytesTransferred = 0;
|
||||
|
||||
// as long as there are DMA requests to process (unless size or vblank is an issue), do not exit
|
||||
while (gDma3Requests[gDma3RequestCursor].size != 0)
|
||||
{
|
||||
totalSize += gDma3Requests[gDma3RequestCursor].size;
|
||||
bytesTransferred += gDma3Requests[gDma3RequestCursor].size;
|
||||
|
||||
if (totalSize > 0xA000)
|
||||
return; // don't do too much at once
|
||||
if (bytesTransferred > 40 * 1024)
|
||||
return; // don't transfer more than 40 KiB
|
||||
if (*(u8 *)REG_ADDR_VCOUNT > 224)
|
||||
return; // we're about to leave vblank, stop
|
||||
|
||||
switch (gDma3Requests[gDma3RequestCursor].mode)
|
||||
{
|
||||
case 1: // regular 32-bit copy
|
||||
case DMA_REQUEST_COPY32: // regular 32-bit copy
|
||||
Dma3CopyLarge32_(gDma3Requests[gDma3RequestCursor].src,
|
||||
gDma3Requests[gDma3RequestCursor].dest,
|
||||
gDma3Requests[gDma3RequestCursor].size);
|
||||
break;
|
||||
case 2: // repeat a single 32-bit value across RAM
|
||||
case DMA_REQUEST_FILL32: // repeat a single 32-bit value across RAM
|
||||
Dma3FillLarge32_(gDma3Requests[gDma3RequestCursor].value,
|
||||
gDma3Requests[gDma3RequestCursor].dest,
|
||||
gDma3Requests[gDma3RequestCursor].size);
|
||||
break;
|
||||
case 3: // regular 16-bit copy
|
||||
case DMA_REQUEST_COPY16: // regular 16-bit copy
|
||||
Dma3CopyLarge16_(gDma3Requests[gDma3RequestCursor].src,
|
||||
gDma3Requests[gDma3RequestCursor].dest,
|
||||
gDma3Requests[gDma3RequestCursor].size);
|
||||
break;
|
||||
case 4: // repeat a single 16-bit value across RAM
|
||||
case DMA_REQUEST_FILL16: // repeat a single 16-bit value across RAM
|
||||
Dma3FillLarge16_(gDma3Requests[gDma3RequestCursor].value,
|
||||
gDma3Requests[gDma3RequestCursor].dest,
|
||||
gDma3Requests[gDma3RequestCursor].size);
|
||||
break;
|
||||
}
|
||||
|
||||
// Free the request
|
||||
gDma3Requests[gDma3RequestCursor].src = NULL;
|
||||
gDma3Requests[gDma3RequestCursor].dest = NULL;
|
||||
gDma3Requests[gDma3RequestCursor].size = 0;
|
||||
@ -124,59 +134,54 @@ void ProcessDma3Requests(void)
|
||||
gDma3Requests[gDma3RequestCursor].value = 0;
|
||||
gDma3RequestCursor++;
|
||||
|
||||
if (gDma3RequestCursor >= 128) // loop back to the first DMA request
|
||||
if (gDma3RequestCursor >= MAX_DMA_REQUESTS) // loop back to the first DMA request
|
||||
gDma3RequestCursor = 0;
|
||||
}
|
||||
}
|
||||
|
||||
int RequestDma3Copy(const void *src, void *dest, u16 size, u8 mode)
|
||||
s16 RequestDma3Copy(const void *src, void *dest, u16 size, u8 mode)
|
||||
{
|
||||
int cursor;
|
||||
int var = 0;
|
||||
|
||||
gDma3ManagerLocked = 1;
|
||||
int i = 0;
|
||||
|
||||
gDma3ManagerLocked = TRUE;
|
||||
cursor = gDma3RequestCursor;
|
||||
while(1)
|
||||
|
||||
while (i < MAX_DMA_REQUESTS)
|
||||
{
|
||||
if(!gDma3Requests[cursor].size) // an empty copy was found and the current cursor will be returned.
|
||||
if (gDma3Requests[cursor].size == 0) // an empty request was found.
|
||||
{
|
||||
gDma3Requests[cursor].src = src;
|
||||
gDma3Requests[cursor].dest = dest;
|
||||
gDma3Requests[cursor].size = size;
|
||||
|
||||
if(mode == 1)
|
||||
gDma3Requests[cursor].mode = mode;
|
||||
if (mode == 1)
|
||||
gDma3Requests[cursor].mode = DMA_REQUEST_COPY32;
|
||||
else
|
||||
gDma3Requests[cursor].mode = 3;
|
||||
gDma3Requests[cursor].mode = DMA_REQUEST_COPY16;
|
||||
|
||||
gDma3ManagerLocked = FALSE;
|
||||
return (s16)cursor;
|
||||
return cursor;
|
||||
}
|
||||
if(++cursor >= 0x80) // loop back to start.
|
||||
{
|
||||
if (++cursor >= MAX_DMA_REQUESTS) // loop back to start.
|
||||
cursor = 0;
|
||||
}
|
||||
if(++var >= 0x80) // max checks were made. all resulted in failure.
|
||||
{
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
gDma3ManagerLocked = FALSE;
|
||||
return -1;
|
||||
return -1; // no free DMA request was found
|
||||
}
|
||||
|
||||
int RequestDma3Fill(s32 value, void *dest, u16 size, u8 mode)
|
||||
s16 RequestDma3Fill(s32 value, void *dest, u16 size, u8 mode)
|
||||
{
|
||||
int cursor;
|
||||
int var = 0;
|
||||
int i = 0;
|
||||
|
||||
cursor = gDma3RequestCursor;
|
||||
gDma3ManagerLocked = 1;
|
||||
gDma3ManagerLocked = TRUE;
|
||||
|
||||
while(1)
|
||||
while (i < MAX_DMA_REQUESTS)
|
||||
{
|
||||
if(!gDma3Requests[cursor].size)
|
||||
if (gDma3Requests[cursor].size == 0) // an empty request was found.
|
||||
{
|
||||
gDma3Requests[cursor].dest = dest;
|
||||
gDma3Requests[cursor].size = size;
|
||||
@ -184,41 +189,39 @@ int RequestDma3Fill(s32 value, void *dest, u16 size, u8 mode)
|
||||
gDma3Requests[cursor].value = value;
|
||||
|
||||
if(mode == 1)
|
||||
gDma3Requests[cursor].mode = 2;
|
||||
gDma3Requests[cursor].mode = DMA_REQUEST_FILL32;
|
||||
else
|
||||
gDma3Requests[cursor].mode = 4;
|
||||
gDma3Requests[cursor].mode = DMA_REQUEST_FILL16;
|
||||
|
||||
gDma3ManagerLocked = FALSE;
|
||||
return (s16)cursor;
|
||||
return cursor;
|
||||
}
|
||||
if(++cursor >= 0x80) // loop back to start.
|
||||
{
|
||||
if (++cursor >= MAX_DMA_REQUESTS) // loop back to start.
|
||||
cursor = 0;
|
||||
}
|
||||
if(++var >= 0x80) // max checks were made. all resulted in failure.
|
||||
{
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
gDma3ManagerLocked = FALSE;
|
||||
return -1;
|
||||
return -1; // no free DMA request was found
|
||||
}
|
||||
|
||||
int CheckForSpaceForDma3Request(s16 index)
|
||||
{
|
||||
int current = 0;
|
||||
int i = 0;
|
||||
|
||||
if (index == -1)
|
||||
if (index == -1) // check if all requests are free
|
||||
{
|
||||
for (; current < 0x80; current ++)
|
||||
if (gDma3Requests[current].size)
|
||||
while (i < MAX_DMA_REQUESTS)
|
||||
{
|
||||
if (gDma3Requests[i].size != 0)
|
||||
return -1;
|
||||
|
||||
i++;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (gDma3Requests[index].size)
|
||||
else // check the specified request
|
||||
{
|
||||
if (gDma3Requests[index].size != 0)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -332,7 +332,6 @@ void SetSerialCallback(IntrCallback callback)
|
||||
}
|
||||
|
||||
extern void CopyBufferedValuesToGpuRegs(void);
|
||||
extern void ProcessDma3Requests(void);
|
||||
|
||||
static void VBlankIntr(void)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user