Skip to content

Commit

Permalink
TWLMenu++ Splash: Remove duplicate instances of oamSet
Browse files Browse the repository at this point in the history
  • Loading branch information
RocketRobz committed Nov 19, 2024
1 parent 3c375ac commit 1f04a77
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 39 deletions.
2 changes: 1 addition & 1 deletion title/arm9/source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2456,7 +2456,7 @@ int titleMode(void)
graphicsInited = false;
}

bool fcFound = flashcardFound();
const bool fcFound = flashcardFound();

if (dsiFeatures() && ms().consoleModel == 0 && !ms().previousUsedDevice && ms().launchType[false] == Launch::EDSiWareLaunch && ms().dsiWareBooter == TWLSettings::EDSiWareUnlaunch && ms().saveLocation != TWLSettings::EGamesFolder) {
// Move .pub and/or .prv back to "saves" folder
Expand Down
66 changes: 28 additions & 38 deletions title/arm9/source/twlmenuppvideo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,27 +140,31 @@ void twlMenuVideo_loadTopGraphics(void) {
(u8*) (sys().isDSPhat() ? logoPhat_anniversaryBitmap : logo_anniversaryBitmap) // image data generated by GRIT
);*/

char currentDate[16];
time_t Raw;
time(&Raw);
const struct tm *Time = localtime(&Raw);
bool december = false;
{
char currentDate[16];
time_t Raw;
time(&Raw);
const struct tm *Time = localtime(&Raw);

strftime(currentDate, sizeof(currentDate), "%m/%d", Time);
strftime(currentDate, sizeof(currentDate), "%m/%d", Time);

bool december = (strncmp(currentDate, "12", 2) == 0
&& strcmp(currentDate, "12/25") != 0
&& strcmp(currentDate, "12/26") != 0
&& strcmp(currentDate, "12/27") != 0
&& strcmp(currentDate, "12/28") != 0
&& strcmp(currentDate, "12/29") != 0
&& strcmp(currentDate, "12/30") != 0
&& strcmp(currentDate, "12/31") != 0);
december = (strncmp(currentDate, "12", 2) == 0
&& strcmp(currentDate, "12/25") != 0
&& strcmp(currentDate, "12/26") != 0
&& strcmp(currentDate, "12/27") != 0
&& strcmp(currentDate, "12/28") != 0
&& strcmp(currentDate, "12/29") != 0
&& strcmp(currentDate, "12/30") != 0
&& strcmp(currentDate, "12/31") != 0);
}

oamInit(&oamMain, SpriteMapping_1D_32, false);

u16* gfx[12];
for (int i = 0; i < 12; i++) {
gfx[i] = oamAllocateGfx(&oamMain, SpriteSize_32x32, SpriteColorFormat_16Color);
oamSet(&oamMain, i, zoomingIconXpos[i], zoomingIconYpos[i], 0, i, SpriteSize_32x32, SpriteColorFormat_16Color, gfx[i], 0, false, false, false, false, false);
}

// NDS
Expand Down Expand Up @@ -191,7 +195,6 @@ void twlMenuVideo_loadTopGraphics(void) {
}
tonccpy(gfx[7], icon_Tiles, icon_TilesLen);
tonccpy(SPRITE_PALETTE+(16*7), icon_Pal, icon_PalLen);
oamSet(&oamMain, 7, zoomingIconXpos[7], zoomingIconYpos[7], 0, 7, SpriteSize_32x32, SpriteColorFormat_16Color, gfx[7], 0, false, false, false, false, false);

// GBA
if (december) {
Expand All @@ -212,15 +215,14 @@ void twlMenuVideo_loadTopGraphics(void) {
}
tonccpy(gfx[3], icon_Tiles, icon_TilesLen);
tonccpy(SPRITE_PALETTE+(16*3), icon_Pal, icon_PalLen);
oamSet(&oamMain, 3, zoomingIconXpos[3], zoomingIconYpos[3], 0, 3, SpriteSize_32x32, SpriteColorFormat_16Color, gfx[3], 0, false, false, false, false, false);

// GBC
if (december) {
icon_Tiles = (u8*)icon_presentTiles;
icon_TilesLen = icon_presentTilesLen;
icon_Pal = (u16*)icon_presentPal;
icon_PalLen = icon_presentPalLen;
} else {
} else {
icon_Tiles = (u8*)icon_gbTiles;
icon_TilesLen = icon_gbTilesLen;
icon_Pal = (u16*)icon_gbPal;
Expand All @@ -233,15 +235,14 @@ void twlMenuVideo_loadTopGraphics(void) {
}
tonccpy(gfx[1], icon_Tiles, icon_TilesLen);
tonccpy(SPRITE_PALETTE+(16*1), icon_Pal, icon_PalLen);
oamSet(&oamMain, 1, zoomingIconXpos[1], zoomingIconYpos[1], 0, 1, SpriteSize_32x32, SpriteColorFormat_16Color, gfx[1], 0, false, false, false, false, false);

// A26
if (december) {
icon_Tiles = (u8*)icon_presentTiles;
icon_TilesLen = icon_presentTilesLen;
icon_Pal = (u16*)icon_presentPal;
icon_PalLen = icon_presentPalLen;
} else {
} else {
icon_Tiles = (u8*)icon_a26Tiles;
icon_TilesLen = icon_a26TilesLen;
icon_Pal = (u16*)icon_a26Pal;
Expand All @@ -254,15 +255,14 @@ void twlMenuVideo_loadTopGraphics(void) {
}
tonccpy(gfx[8], icon_Tiles, icon_TilesLen);
tonccpy(SPRITE_PALETTE+(16*8), icon_Pal, icon_PalLen);
oamSet(&oamMain, 8, zoomingIconXpos[8], zoomingIconYpos[8], 0, 8, SpriteSize_32x32, SpriteColorFormat_16Color, gfx[8], 0, false, false, false, false, false);

// INT
if (december) {
icon_Tiles = (u8*)icon_presentTiles;
icon_TilesLen = icon_presentTilesLen;
icon_Pal = (u16*)icon_presentPal;
icon_PalLen = icon_presentPalLen;
} else {
} else {
icon_Tiles = (u8*)icon_intTiles;
icon_TilesLen = icon_intTilesLen;
icon_Pal = (u16*)icon_intPal;
Expand All @@ -275,15 +275,14 @@ void twlMenuVideo_loadTopGraphics(void) {
}
tonccpy(gfx[10], icon_Tiles, icon_TilesLen);
tonccpy(SPRITE_PALETTE+(16*10), icon_Pal, icon_PalLen);
oamSet(&oamMain, 10, zoomingIconXpos[10], zoomingIconYpos[10], 0, 10, SpriteSize_32x32, SpriteColorFormat_16Color, gfx[10], 0, false, false, false, false, false);

// NES
if (december) {
icon_Tiles = (u8*)icon_presentTiles;
icon_TilesLen = icon_presentTilesLen;
icon_Pal = (u16*)icon_presentPal;
icon_PalLen = icon_presentPalLen;
} else {
} else {
icon_Tiles = (u8*)icon_nesTiles;
icon_TilesLen = icon_nesTilesLen;
icon_Pal = (u16*)icon_nesPal;
Expand All @@ -296,15 +295,14 @@ void twlMenuVideo_loadTopGraphics(void) {
}
tonccpy(gfx[0], icon_Tiles, icon_TilesLen);
tonccpy(SPRITE_PALETTE, icon_Pal, icon_PalLen);
oamSet(&oamMain, 0, zoomingIconXpos[0], zoomingIconYpos[0], 0, 0, SpriteSize_32x32, SpriteColorFormat_16Color, gfx[0], 0, false, false, false, false, false);

// SMS
if (december) {
icon_Tiles = (u8*)icon_presentTiles;
icon_TilesLen = icon_presentTilesLen;
icon_Pal = (u16*)icon_presentPal;
icon_PalLen = icon_presentPalLen;
} else {
} else {
icon_Tiles = (u8*)icon_smsTiles;
icon_TilesLen = icon_smsTilesLen;
icon_Pal = (u16*)icon_smsPal;
Expand All @@ -317,15 +315,14 @@ void twlMenuVideo_loadTopGraphics(void) {
}
tonccpy(gfx[4], icon_Tiles, icon_TilesLen);
tonccpy(SPRITE_PALETTE+(16*4), icon_Pal, icon_PalLen);
oamSet(&oamMain, 4, zoomingIconXpos[4], zoomingIconYpos[4], 0, 4, SpriteSize_32x32, SpriteColorFormat_16Color, gfx[4], 0, false, false, false, false, false);

// GG
if (december) {
icon_Tiles = (u8*)icon_presentTiles;
icon_TilesLen = icon_presentTilesLen;
icon_Pal = (u16*)icon_presentPal;
icon_PalLen = icon_presentPalLen;
} else {
} else {
icon_Tiles = (u8*)icon_ggTiles;
icon_TilesLen = icon_ggTilesLen;
icon_Pal = (u16*)icon_ggPal;
Expand All @@ -338,15 +335,14 @@ void twlMenuVideo_loadTopGraphics(void) {
}
tonccpy(gfx[6], icon_Tiles, icon_TilesLen);
tonccpy(SPRITE_PALETTE+(16*6), icon_Pal, icon_PalLen);
oamSet(&oamMain, 6, zoomingIconXpos[6], zoomingIconYpos[6], 0, 6, SpriteSize_32x32, SpriteColorFormat_16Color, gfx[6], 0, false, false, false, false, false);

// PCE
if (december) {
icon_Tiles = (u8*)icon_presentTiles;
icon_TilesLen = icon_presentTilesLen;
icon_Pal = (u16*)icon_presentPal;
icon_PalLen = icon_presentPalLen;
} else {
} else {
icon_Tiles = (u8*)icon_pceTiles;
icon_TilesLen = icon_pceTilesLen;
icon_Pal = (u16*)icon_pcePal;
Expand All @@ -359,15 +355,14 @@ void twlMenuVideo_loadTopGraphics(void) {
}
tonccpy(gfx[9], icon_Tiles, icon_TilesLen);
tonccpy(SPRITE_PALETTE+(16*9), icon_Pal, icon_PalLen);
oamSet(&oamMain, 9, zoomingIconXpos[9], zoomingIconYpos[9], 0, 9, SpriteSize_32x32, SpriteColorFormat_16Color, gfx[9], 0, false, false, false, false, false);

// MD
if (december) {
icon_Tiles = (u8*)icon_presentTiles;
icon_TilesLen = icon_presentTilesLen;
icon_Pal = (u16*)icon_presentPal;
icon_PalLen = icon_presentPalLen;
} else {
} else {
icon_Tiles = (u8*)icon_mdTiles;
icon_TilesLen = icon_mdTilesLen;
icon_Pal = (u16*)icon_mdPal;
Expand All @@ -380,15 +375,14 @@ void twlMenuVideo_loadTopGraphics(void) {
}
tonccpy(gfx[5], icon_Tiles, icon_TilesLen);
tonccpy(SPRITE_PALETTE+(16*5), icon_Pal, icon_PalLen);
oamSet(&oamMain, 5, zoomingIconXpos[5], zoomingIconYpos[5], 0, 5, SpriteSize_32x32, SpriteColorFormat_16Color, gfx[5], 0, false, false, false, false, false);

// SNES
if (december) {
icon_Tiles = (u8*)icon_presentTiles;
icon_TilesLen = icon_presentTilesLen;
icon_Pal = (u16*)icon_presentPal;
icon_PalLen = icon_presentPalLen;
} else {
} else {
icon_Tiles = (u8*)icon_snesTiles;
icon_TilesLen = icon_snesTilesLen;
icon_Pal = (u16*)icon_snesPal;
Expand All @@ -401,15 +395,14 @@ void twlMenuVideo_loadTopGraphics(void) {
}
tonccpy(gfx[2], icon_Tiles, icon_TilesLen);
tonccpy(SPRITE_PALETTE+(16*2), icon_Pal, icon_PalLen);
oamSet(&oamMain, 2, zoomingIconXpos[2], zoomingIconYpos[2], 0, 2, SpriteSize_32x32, SpriteColorFormat_16Color, gfx[2], 0, false, false, false, false, false);

// MSX
if (december) {
icon_Tiles = (u8*)icon_presentTiles;
icon_TilesLen = icon_presentTilesLen;
icon_Pal = (u16*)icon_presentPal;
icon_PalLen = icon_presentPalLen;
} else {
} else {
icon_Tiles = (u8*)icon_msxTiles;
icon_TilesLen = icon_msxTilesLen;
icon_Pal = (u16*)icon_msxPal;
Expand All @@ -422,7 +415,6 @@ void twlMenuVideo_loadTopGraphics(void) {
}
tonccpy(gfx[11], icon_Tiles, icon_TilesLen);
tonccpy(SPRITE_PALETTE+(16*11), icon_Pal, icon_PalLen);
oamSet(&oamMain, 11, zoomingIconXpos[11], zoomingIconYpos[11], 0, 11, SpriteSize_32x32, SpriteColorFormat_16Color, gfx[11], 0, false, false, false, false, false);
}

extern char soundBank[];
Expand Down Expand Up @@ -551,9 +543,7 @@ void twlMenuVideo_topGraphicRender(void) {
for (int i = 0; i < 12; i++) {
oamSetXY(&oamMain, i, zoomingIconXpos[i], zoomingIconYpos[i]);
}
if (highFPS) {
while (REG_VCOUNT < 88); // Fix/Hide screen tearing
}
while (REG_VCOUNT < 88); // Fix/Hide screen tearing
oamUpdate(&oamMain);

frameDelaySprite = 0;
Expand Down

0 comments on commit 1f04a77

Please sign in to comment.