Skip to content

Commit

Permalink
v1.6b - minor correction to Maria sprite rendering.
Browse files Browse the repository at this point in the history
  • Loading branch information
wavemotion-dave committed Dec 19, 2020
1 parent 1137712 commit f1c9b4a
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 84 deletions.
Binary file modified A7800DS.nds
Binary file not shown.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION=1.6a
VERSION=1.6b
TARGNAME=A7800DS

#---------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion arm9/source/emu/Database.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ Database_Entry game_list[] = {
{"c3107d3e3e17d67e3a11d47a5946a4f3",2,true, 1,1,0,0, false, 0, 20, 256, 220}, // title=Donkey Kong XM Demo (purposely set HSC to false)
{"543484c00ba233736bcaba2da20eeea9",6,false,1,1,0,3, false, 0, 22, 256, 220}, // title=Double Dragon
{"de2ebafcf0e37aaa9d0e9525a7f4dd62",6,false,1,1,1,3, false, 0, 22, 256, 220}, // title=Double Dragon
{"b3143adbbb7d7d189e918e5b29d55a72",0,true ,1,1,0,0, true, 0, 22, 256, 220}, // title=Dungeon Stalker (homebrew)
{"b3143adbbb7d7d189e918e5b29d55a72",0,true ,1,1,0,0, true, 0, 23, 256, 220}, // title=Dungeon Stalker (homebrew)
{"2251a6a0f3aec84cc0aff66fc9fa91e8",5,false,1,1,0,0, false, 0, 22, 256, 220}, // title=F-18 Hornet
{"e7709da8e49d3767301947a0a0b9d2e6",5,false,1,1,1,0, false, 0, 22, 256, 220}, // title=F-18 Hornet
{"6287727ab36391a62f728bbdee88675c",0,false,1,1,0,0, true, 0, 22, 256, 220}, // title=Failsafe (homebrew)
Expand Down
110 changes: 29 additions & 81 deletions arm9/source/emu/Maria.itcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,32 +63,23 @@ static byte maria_h08;
static byte maria_h16;
static byte maria_wmode;

static inline void _maria_ClearCells(void)
{
if(maria_horizontal < MARIA_LINERAM_SIZE)
{
if (memory_ram[CTRL] & 4)
{
*((u16 *)&maria_lineRAM[maria_horizontal]) = 0;
}
}
maria_horizontal += 2;
}

// ----------------------------------------------------------------------------
//ClearCells - 4 bytes at a time
// ----------------------------------------------------------------------------
static inline void _maria_ClearCells4(void)
{
if(maria_horizontal < MARIA_LINERAM_SIZE)
if (memory_ram[CTRL] & 4)
{
if (memory_ram[CTRL] & 4)
{
*((u32 *)&maria_lineRAM[maria_horizontal]) = 0;
}
if ((maria_horizontal+3) < MARIA_LINERAM_SIZE)
{
*((u32 *)&maria_lineRAM[maria_horizontal]) = 0;
}
}
maria_horizontal += 4;
}

// ----------------------------------------------------------------------------
// StoreCell
// StoreCells - 4 bytes at a time
// ----------------------------------------------------------------------------
static inline void _maria_StoreCells4(byte data)
{
Expand Down Expand Up @@ -119,56 +110,41 @@ static inline void _maria_StoreCells4(byte data)
maria_horizontal += 4;
}

// ----------------------------------------------------------------------------
// StoreCell - wide mode
// ----------------------------------------------------------------------------
static inline void maria_StoreCellWide(byte data)
{
if((maria_horizontal+1) < MARIA_LINERAM_SIZE)
{
byte *ptr = (byte *)&maria_lineRAM[maria_horizontal];
byte high=(data >> 4);
byte low=(data & 0x0F);
byte mp = (maria_palette & 16);
if (high)
if (data)
{
*ptr = mp | high;
}
else
{
if(memory_ram[CTRL] & 4)
byte high=(data >> 4);
byte low=(data & 0x0F);
byte mp = (maria_palette & 16);
if (high)
{
*ptr = 0;
}
}
ptr++;
if (low)
{
*ptr = mp | low;
*ptr = mp | high;
}
if (low)
{
ptr++;
*ptr = mp | low;
}
}
else
{
if(memory_ram[CTRL] & 4)
if ((memory_ram[CTRL] & 4))
{
*ptr = 0;
*ptr++ = 0;
*ptr = 0;
}
}
}
maria_horizontal += 2;
}

// ----------------------------------------------------------------------------
// StoreCell
// ----------------------------------------------------------------------------
static inline void maria_ClearCellWide(void)
{
if(memory_ram[CTRL] & 4)
{
byte *ptr = (byte *)&maria_lineRAM[maria_horizontal];
if(maria_horizontal < MARIA_LINERAM_SIZE) *ptr++ = 0;
maria_horizontal++;
if(maria_horizontal < MARIA_LINERAM_SIZE) *ptr = 0;
maria_horizontal++;
}
else maria_horizontal += 2;
}

// ----------------------------------------------------------------------------
// IsHolyDMA
Expand Down Expand Up @@ -215,30 +191,6 @@ static u8 wide_lookup[256] =
0x33, 0x37, 0x3B, 0x3F, 0x73, 0x77, 0x7B, 0x7F, 0xB3, 0xB7, 0xBB, 0xBF, 0xF3, 0xF7, 0xFB, 0xFF
};

// ----------------------------------------------------------------------------
// StoreCell
// ----------------------------------------------------------------------------
static inline void maria_StoreCell(byte high, byte low)
{
if(maria_horizontal < MARIA_LINERAM_SIZE)
{
if(low || high)
{
maria_lineRAM[maria_horizontal] = (maria_palette & 16) | high | low;
}
else
{
byte kmode = memory_ram[CTRL] & 4;
if(kmode)
{
maria_lineRAM[maria_horizontal] = 0;
}
}
}
maria_horizontal++;
}


// ----------------------------------------------------------------------------
// StoreGraphic
// ----------------------------------------------------------------------------
Expand All @@ -247,22 +199,18 @@ static inline void maria_StoreGraphic( )
byte data = memory_ram[maria_pp.w];
if(maria_wmode)
{
if(maria_IsHolyDMA() || !data)
if(maria_IsHolyDMA())
{
maria_horizontal += 2;
}
else if (!data)
{
maria_ClearCellWide();
}
else
{
maria_StoreCellWide(wide_lookup[data]);
}
}
else
{
if(maria_IsHolyDMA() || !data)
if(maria_IsHolyDMA())
{
maria_horizontal += 4;
}
Expand Down
2 changes: 1 addition & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Features :
--------------------------------------------------------------------------------
History :
--------------------------------------------------------------------------------
V1.6a : 19-Dec-2020 by wavemotion-dave
V1.6b : 19-Dec-2020 by wavemotion-dave
* Fixed bug causing black rectangles on some games - thanks to Wii-7800!

V1.6 : 17-Dec-2020 by wavemotion-dave
Expand Down

0 comments on commit f1c9b4a

Please sign in to comment.