Skip to content

Commit

Permalink
4 space indent -> tabs
Browse files Browse the repository at this point in the history
ALSO: Replace if chain with else if in icon Handler for DSi Theme
  • Loading branch information
NightScript370 authored Sep 12, 2022
1 parent 09e3eda commit 49d7653
Show file tree
Hide file tree
Showing 30 changed files with 559 additions and 610 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"diffEditor.ignoreTrimWhitespace": false
}
10 changes: 5 additions & 5 deletions gbapatcher/arm9/source/fileCopy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@

off_t getFileSize(const char *fileName)
{
FILE* fp = fopen(fileName, "rb");
off_t fsize = 0;
if (fp) {
fseek(fp, 0, SEEK_END);
fsize = ftell(fp); // Get source file's size
FILE* fp = fopen(fileName, "rb");
off_t fsize = 0;
if (fp) {
fseek(fp, 0, SEEK_END);
fsize = ftell(fp); // Get source file's size
fseek(fp, 0, SEEK_SET);
}
fclose(fp);
Expand Down
8 changes: 4 additions & 4 deletions gbapatcher/arm9/source/gbaswitch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ void loadGbaBorder(void) {
if ((i % 256) == 255) alternatePixel = !alternatePixel;
alternatePixel = !alternatePixel;
}
DC_FlushRange(bmpImageBuffer,SCREEN_WIDTH*SCREEN_HEIGHT*2);
dmaCopy(bmpImageBuffer,(void*)BG_BMP_RAM(0),SCREEN_WIDTH*SCREEN_HEIGHT*2);
DC_FlushRange(bmpImageBuffer,SCREEN_WIDTH*SCREEN_HEIGHT*2);
dmaCopy(bmpImageBuffer,(void*)BG_BMP_RAM(0),SCREEN_WIDTH*SCREEN_HEIGHT*2);

alternatePixel = false;
for(uint i = 0; i < image.size()/4; i++) {
Expand Down Expand Up @@ -75,8 +75,8 @@ void loadGbaBorder(void) {
if ((i % 256) == 255) alternatePixel = !alternatePixel;
alternatePixel = !alternatePixel;
}
DC_FlushRange(bmpImageBuffer,SCREEN_WIDTH*SCREEN_HEIGHT*2);
dmaCopy(bmpImageBuffer,(void*)BG_BMP_RAM(8),SCREEN_WIDTH*SCREEN_HEIGHT*2);
DC_FlushRange(bmpImageBuffer,SCREEN_WIDTH*SCREEN_HEIGHT*2);
dmaCopy(bmpImageBuffer,(void*)BG_BMP_RAM(8),SCREEN_WIDTH*SCREEN_HEIGHT*2);
}

void gbaSwitch(void) {
Expand Down
2 changes: 1 addition & 1 deletion gbapatcher/arm9/source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ int main(int argc, char **argv) {
nitroFSInit("/_nds/TWiLightMenu/gbapatcher.srldr");

CIniFile settingsini("/_nds/TWiLightMenu/settings.ini");
gbaBorder = settingsini.GetString("SRLOADER", "GBA_BORDER", gbaBorder);
gbaBorder = settingsini.GetString("SRLOADER", "GBA_BORDER", gbaBorder);

char borderPath[256];
sprintf(borderPath, "/_nds/TWiLightMenu/gbaborders/%s", gbaBorder.c_str());
Expand Down
13 changes: 4 additions & 9 deletions gbapatcher/arm9/source/save/Save.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,16 @@ ITCM_CODE const save_type_t* save_findTag()
char saveTag[16];
while (curAddr < 0x08000000+romSize)
{
u32 fst = *(u32*)curAddr;
u32 fst = *(u32*)curAddr;
tonccpy(&saveTag, (u8*)curAddr, 16);
SaveType type = SAVE_TYPE_NONE;
if (fst == 0x53414C46 && (saveTag[5] == '_' || saveTag[5] == '5' || saveTag[5] == '1'))
{
if (fst == 0x53414C46 && (saveTag[5] == '_' || saveTag[5] == '5' || saveTag[5] == '1')) {
//FLAS
type = SAVE_TYPE_FLASH;
}
else if (fst == 0x4D415253)
{
} else if (fst == 0x4D415253) {
//SRAM
type = SAVE_TYPE_SRAM;
}
else if (fst == 0x52504545 && saveTag[6] == '_')
{
} else if (fst == 0x52504545 && saveTag[6] == '_') {
//EEPR
type = SAVE_TYPE_EEPROM;
}
Expand Down
22 changes: 11 additions & 11 deletions quickmenu/arm9/source/fileCopy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ extern int progressBarLength;

off_t getFileSize(const char *fileName)
{
FILE* fp = fopen(fileName, "rb");
off_t fsize = 0;
if (fp) {
fseek(fp, 0, SEEK_END);
fsize = ftell(fp); // Get source file's size
FILE* fp = fopen(fileName, "rb");
off_t fsize = 0;
if (fp) {
fseek(fp, 0, SEEK_END);
fsize = ftell(fp); // Get source file's size
fseek(fp, 0, SEEK_SET);
}
fclose(fp);
Expand All @@ -24,18 +24,18 @@ char copyBuf[0x8000];

int fcopy(const char *sourcePath, const char *destinationPath)
{
FILE* sourceFile = fopen(sourcePath, "rb");
off_t fsize = 0;
if (sourceFile) {
fseek(sourceFile, 0, SEEK_END);
fsize = ftell(sourceFile); // Get source file's size
FILE* sourceFile = fopen(sourcePath, "rb");
off_t fsize = 0;
if (sourceFile) {
fseek(sourceFile, 0, SEEK_END);
fsize = ftell(sourceFile); // Get source file's size
fseek(sourceFile, 0, SEEK_SET);
} else {
fclose(sourceFile);
return 1;
}

FILE* destinationFile = fopen(destinationPath, "wb");
FILE* destinationFile = fopen(destinationPath, "wb");
if (!destinationFile) {
fclose(sourceFile);
fclose(destinationFile);
Expand Down
8 changes: 4 additions & 4 deletions quickmenu/arm9/source/gbaswitch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ void loadGbaBorder(const char* filename) {
if ((i % 256) == 255) alternatePixel = !alternatePixel;
alternatePixel = !alternatePixel;
}
DC_FlushRange(bmpImageBuffer,SCREEN_WIDTH*SCREEN_HEIGHT*2);
dmaCopy(bmpImageBuffer,(void*)BG_BMP_RAM(0),SCREEN_WIDTH*SCREEN_HEIGHT*2);
DC_FlushRange(bmpImageBuffer,SCREEN_WIDTH*SCREEN_HEIGHT*2);
dmaCopy(bmpImageBuffer,(void*)BG_BMP_RAM(0),SCREEN_WIDTH*SCREEN_HEIGHT*2);

alternatePixel = false;
for(uint i = 0; i < image.size()/4; i++) {
Expand Down Expand Up @@ -64,8 +64,8 @@ void loadGbaBorder(const char* filename) {
if ((i % 256) == 255) alternatePixel = !alternatePixel;
alternatePixel = !alternatePixel;
}
DC_FlushRange(bmpImageBuffer,SCREEN_WIDTH*SCREEN_HEIGHT*2);
dmaCopy(bmpImageBuffer,(void*)BG_BMP_RAM(8),SCREEN_WIDTH*SCREEN_HEIGHT*2);
DC_FlushRange(bmpImageBuffer,SCREEN_WIDTH*SCREEN_HEIGHT*2);
dmaCopy(bmpImageBuffer,(void*)BG_BMP_RAM(8),SCREEN_WIDTH*SCREEN_HEIGHT*2);
}

void gbaSwitch(void) {
Expand Down
40 changes: 17 additions & 23 deletions romsel_aktheme/arm9/source/systemfilenames.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,21 @@

void SystemFilenames::initFilenames()
{
std::string systemDirectory = formatString(SFN_SYSTEM_UI_DIRECTORY "%s", ms().ak_theme.c_str());
if (!sys().useNitroFS())
{
nocashMessage("NNONITROFS");
nocashMessage(systemDirectory.c_str());
nocashMessage(ms().ak_theme.c_str());
_uiDirectory = systemDirectory;
}
else
{
if (access((systemDirectory + "/uisettings.ini").c_str(), F_OK) == 0)
{
nocashMessage("NITROFSOK");
nocashMessage(systemDirectory.c_str());
_uiDirectory = systemDirectory;
}
else
{
cwl();
nocashMessage(SFN_FALLBACK_UI_DIRECTORY);
_uiDirectory = SFN_FALLBACK_UI_DIRECTORY;
}
}
std::string systemDirectory = formatString(SFN_SYSTEM_UI_DIRECTORY "%s", ms().ak_theme.c_str());
if (!sys().useNitroFS()) {
nocashMessage("NNONITROFS");
nocashMessage(systemDirectory.c_str());
nocashMessage(ms().ak_theme.c_str());
_uiDirectory = systemDirectory;
} else {
if (access((systemDirectory + "/uisettings.ini").c_str(), F_OK) == 0) {
nocashMessage("NITROFSOK");
nocashMessage(systemDirectory.c_str());
_uiDirectory = systemDirectory;
} else {
cwl();
nocashMessage(SFN_FALLBACK_UI_DIRECTORY);
_uiDirectory = SFN_FALLBACK_UI_DIRECTORY;
}
}
}
22 changes: 11 additions & 11 deletions romsel_dsimenutheme/arm9/source/fileCopy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ extern int progressBarLength;

off_t getFileSize(const char *fileName)
{
FILE* fp = fopen(fileName, "rb");
off_t fsize = 0;
if (fp) {
fseek(fp, 0, SEEK_END);
fsize = ftell(fp); // Get source file's size
FILE* fp = fopen(fileName, "rb");
off_t fsize = 0;
if (fp) {
fseek(fp, 0, SEEK_END);
fsize = ftell(fp); // Get source file's size
fseek(fp, 0, SEEK_SET);
}
fclose(fp);
Expand All @@ -24,18 +24,18 @@ char copyBuf[0x8000];

int fcopy(const char *sourcePath, const char *destinationPath)
{
FILE* sourceFile = fopen(sourcePath, "rb");
off_t fsize = 0;
if (sourceFile) {
fseek(sourceFile, 0, SEEK_END);
fsize = ftell(sourceFile); // Get source file's size
FILE* sourceFile = fopen(sourcePath, "rb");
off_t fsize = 0;
if (sourceFile) {
fseek(sourceFile, 0, SEEK_END);
fsize = ftell(sourceFile); // Get source file's size
fseek(sourceFile, 0, SEEK_SET);
} else {
fclose(sourceFile);
return 1;
}

FILE* destinationFile = fopen(destinationPath, "wb");
FILE* destinationFile = fopen(destinationPath, "wb");
if (!destinationFile) {
fclose(sourceFile);
fclose(destinationFile);
Expand Down
8 changes: 4 additions & 4 deletions romsel_dsimenutheme/arm9/source/gbaswitch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ void loadGbaBorder(const char* filename) {
if ((i % 256) == 255) alternatePixel = !alternatePixel;
alternatePixel = !alternatePixel;
}
DC_FlushRange(tex().bmpImageBuffer(),SCREEN_WIDTH*SCREEN_HEIGHT*2);
dmaCopy(tex().bmpImageBuffer(),(void*)BG_BMP_RAM(0),SCREEN_WIDTH*SCREEN_HEIGHT*2);
DC_FlushRange(tex().bmpImageBuffer(),SCREEN_WIDTH*SCREEN_HEIGHT*2);
dmaCopy(tex().bmpImageBuffer(),(void*)BG_BMP_RAM(0),SCREEN_WIDTH*SCREEN_HEIGHT*2);

alternatePixel = false;
for(uint i = 0; i < image.size()/4; i++) {
Expand Down Expand Up @@ -61,8 +61,8 @@ void loadGbaBorder(const char* filename) {
if ((i % 256) == 255) alternatePixel = !alternatePixel;
alternatePixel = !alternatePixel;
}
DC_FlushRange(tex().bmpImageBuffer(),SCREEN_WIDTH*SCREEN_HEIGHT*2);
dmaCopy(tex().bmpImageBuffer(),(void*)BG_BMP_RAM(8),SCREEN_WIDTH*SCREEN_HEIGHT*2);
DC_FlushRange(tex().bmpImageBuffer(),SCREEN_WIDTH*SCREEN_HEIGHT*2);
dmaCopy(tex().bmpImageBuffer(),(void*)BG_BMP_RAM(8),SCREEN_WIDTH*SCREEN_HEIGHT*2);
}

void gbaSwitch(void) {
Expand Down
9 changes: 3 additions & 6 deletions romsel_dsimenutheme/arm9/source/graphics/ThemeTextures.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -694,8 +694,7 @@ void ThemeTextures::drawTopBg() {

if (ms().colorMode == 1) {
for (u16 i = 0; i < BG_BUFFER_PIXELCOUNT; i++) {
_bgSubBuffer[i] =
convertVramColorToGrayscale(_bgSubBuffer[i]);
_bgSubBuffer[i] = convertVramColorToGrayscale(_bgSubBuffer[i]);
}
}

Expand All @@ -720,8 +719,7 @@ void ThemeTextures::drawBottomBg(int index) {

if (ms().colorMode == 1) {
for (u16 i = 0; i < BG_BUFFER_PIXELCOUNT; i++) {
_bgMainBuffer[i] =
convertVramColorToGrayscale(_bgMainBuffer[i]);
_bgMainBuffer[i] = convertVramColorToGrayscale(_bgMainBuffer[i]);
}
}

Expand Down Expand Up @@ -1222,8 +1220,7 @@ void ThemeTextures::drawTopBgAvoidingShoulders() {

if (ms().colorMode == 1) {
for (u16 i = 0; i < BG_BUFFER_PIXELCOUNT; i++) {
_bgSubBuffer[i] =
convertVramColorToGrayscale(_bgSubBuffer[i]);
_bgSubBuffer[i] = convertVramColorToGrayscale(_bgSubBuffer[i]);
if (boxArtColorDeband)
_bgSubBuffer2[i] = _bgSubBuffer[i];
}
Expand Down
5 changes: 1 addition & 4 deletions romsel_dsimenutheme/arm9/source/graphics/graphics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -798,10 +798,7 @@ void vBlankHandler() {
(titleboxYpos - 1) - movingAppYpos + titleboxYposDropDown[movingApp % 5],
GL_FLIP_NONE, &tex().settingsImage()[1]);
else
drawRomIcon(112,
(titleboxYpos + 12) - movingAppYpos + titleboxYposDropDown[movingApp % 5],
-1,
bnrRomType[movingApp]);
drawRomIcon(112, (titleboxYpos + 12) - movingAppYpos + titleboxYposDropDown[movingApp % 5], -1, bnrRomType[movingApp]);
}
}

Expand Down
46 changes: 23 additions & 23 deletions romsel_dsimenutheme/arm9/source/graphics/iconHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,45 +67,45 @@ static u16 blackPalette[16 * 8] = {0};
const glImage *getIcon(int num) {
if (num == GBA_ICON)
return _gbaIcon;
if (num == GBC_ICON)
else if (num == GBC_ICON)
return _gbcIcon;
if (num == NES_ICON)
else if (num == NES_ICON)
return _nesIcon;
if (num == SG_ICON)
else if (num == SG_ICON)
return _smsIcon;
if (num == SMS_ICON)
else if (num == SMS_ICON)
return _smsIcon;
if (num == GG_ICON)
else if (num == GG_ICON)
return _ggIcon;
if (num == MD_ICON)
else if (num == MD_ICON)
return _mdIcon;
if (num == SNES_ICON)
else if (num == SNES_ICON)
return _snesIcon;
/*if (num == MSX_ICON)
return _msxIcon;*/
if (num == PLG_ICON)
/*else if (num == MSX_ICON)
return _msxIcon;*/
else if (num == PLG_ICON)
return _plgIcon;
if (num == A26_ICON)
else if (num == A26_ICON)
return _a26Icon;
if (num == COL_ICON)
return _colIcon;
if (num == M5_ICON)
return _m5Icon;
if (num == INT_ICON)
else if (num == COL_ICON)
return _colIcon;
else if (num == M5_ICON)
return _m5Icon;
else if (num == INT_ICON)
return _intIcon;
if (num == PCE_ICON)
else if (num == PCE_ICON)
return _pceIcon;
if (num == WS_ICON)
else if (num == WS_ICON)
return _wsIcon;
if (num == NGP_ICON)
else if (num == NGP_ICON)
return _ngpIcon;
if (num == CPC_ICON)
else if (num == CPC_ICON)
return _cpcIcon;
if (num == VID_ICON)
else if (num == VID_ICON)
return _vidIcon;
if (num == IMG_ICON)
else if (num == IMG_ICON)
return _imgIcon;
if (BAD_ICON_IDX(num) || !initialized)
else if (BAD_ICON_IDX(num) || !initialized)
return NULL;
return _ndsIcon[num];
}
Expand Down
Loading

0 comments on commit 49d7653

Please sign in to comment.