Пример #1
0
void LoadScreen() {

		// Display Load Screen
		swiDecompressLZSSVram ((void*)topLoadTiles, (void*)CHAR_BASE_BLOCK(2), 0, &decompressBiosCallback);
		swiDecompressLZSSVram ((void*)subLoadTiles, (void*)CHAR_BASE_BLOCK_SUB(2), 0, &decompressBiosCallback);
		vramcpy_ui (&BG_PALETTE[0], topLoadPal, topLoadPalLen);
		vramcpy_ui (&BG_PALETTE_SUB[0], subLoadPal, subLoadPalLen);

}
Пример #2
0
void decompressStream(const void* data, void* dst, DecompressType type, getByteCallback readCB, getHeaderCallback getHeaderCB)
{
#ifdef ARM9
	sassert(type != LZ77 && type != RLE, "LZ77 and RLE do not support streaming, use Vram versions");
#endif


	TDecompressionStream decompresStream =
	{
		getHeaderCB,
		0,
		readCB
	};

	switch(type)
	{
		case LZ77Vram:
			swiDecompressLZSSVram((void*)data, (void*)dst, 0, &decompresStream);
			break;
		case HUFF:
			swiDecompressHuffman((void*)data, (void*)dst, 0, &decompresStream);
			break;
		case RLEVram:
			swiDecompressRLEVram((void*)data, (void*)dst, 0, &decompresStream);
			break;
		default:
			break;
	}
}
Пример #3
0
void decompress(const void* data, void* dst, DecompressType type)
{
	switch(type)
	{
		case LZ77Vram:
			swiDecompressLZSSVram((void*)data, (void*)dst, 0, &decomStream);
			break;
		case LZ77:
			swiDecompressLZSSWram((void*)data, (void*)dst);
			break;
		case HUFF:
			swiDecompressHuffman((void*)data, (void*)dst, 0, &decomStream);
			break;
		case RLE:
			swiDecompressRLEWram((void*)data, (void*)dst);
			break;
		case RLEVram:
			swiDecompressRLEVram((void*)data, (void*)dst, 0, &decomStream);
			break;
		default:
			break;
	}
}
Пример #4
0
int main( int argc, char **argv) {

	// defaultExceptionHandler();

	if (fatInitDefault()) {
		fifoWaitValue32(FIFO_USER_02);
		if (fifoGetValue32(FIFO_USER_01) == 0) {
			int size = 32;
			FILE* ResetData = fopen("sd:/hiya/ResetData.bin","rb");
			fread((void*)0x02000300,1,size,ResetData);
			fclose(ResetData);
			fifoSendValue32(FIFO_USER_08, 1);
			for (int i = 0; i < 5; i++) { swiWaitForVBlank(); }
		}

		LoadSettings();
	
		bool gotoSettings = false;
		if (access("sd:/hiya/settings.ini", F_OK)) {
			gotoSettings = true;
		}
	
		scanKeys();

		if(keysHeld() & KEY_SELECT) gotoSettings = true;
		
		if(gotoSettings) {
			// Subscreen as a console
			videoSetMode(MODE_0_2D);
			vramSetBankG(VRAM_G_MAIN_BG);
			videoSetModeSub(MODE_0_2D);
			vramSetBankH(VRAM_H_SUB_BG);
			
			int pressed = 0;
			bool menuprinted = true;
			
			while(1) {
				if(menuprinted) {
					consoleInit(NULL, 0, BgType_Text4bpp, BgSize_T_256x256, 15, 0, true, true);
					consoleClear();
					
					printf("HiyaCFW v1.0 configuration\n");
					printf("Press A to select, START to save");
					printf("\n");
					
					if(cursorPosition == 0) printf(">");
					else printf(" ");
					
					printf("Splash: ");
					if(splash)
						printf("Off( ), On(x)");
					else
						printf("Off(x), On( )");
					printf("\n\n");
					
					if(cursorPosition == 1) printf(">");
					else printf(" ");

					if(dsiSplash)
						printf("(x)");
					else
						printf("( )");
					printf(" DSi Splash/H&S screen");

					consoleInit(NULL, 1, BgType_Text4bpp, BgSize_T_256x256, 15, 0, false, true);
					consoleClear();
					
					if(cursorPosition == 0) {
						printf("Enable splash screen.");
					} else if(cursorPosition == 1) {
						printf("Enable showing the DSi Splash/\n");
						printf("Health & Safety screen.");
					}
					
					menuprinted = false;
				}
				
				do {
					scanKeys();
					pressed = keysDownRepeat();
					swiWaitForVBlank();
				} while (!pressed);
				
				if (pressed & KEY_A) {
					switch(cursorPosition){
						case 0:
						default:
							splash = !splash;
							break;
						case 1:
							dsiSplash = !dsiSplash;
							break;
					}
					menuprinted = true;
				}
				
				if (pressed & KEY_UP) {
					cursorPosition -= 1;
					menuprinted = true;
				} else if (pressed & KEY_DOWN) {
					cursorPosition += 1;
					menuprinted = true;
				}
				
				if (cursorPosition < 0) cursorPosition = 1;
				if (cursorPosition > 1) cursorPosition = 0;
				
				if (pressed & KEY_START) {
					SaveSettings();
					break;
				}
			}
		}

		if(dsiSplash) fifoSendValue32(FIFO_USER_03, 1);
		
		if(splash) {
			BootSplashInit();

			LoadScreen();
			
			for (int i = 0; i < 60*3; i++) { swiWaitForVBlank(); }
		}

		runNdsFile("/BOOTLOADER.NDS", 0, NULL);

	} else {
		BootSplashInit();
		
		// Display Error Screen
		swiDecompressLZSSVram ((void*)topErrorTiles, (void*)CHAR_BASE_BLOCK(2), 0, &decompressBiosCallback);
		swiDecompressLZSSVram ((void*)subErrorTiles, (void*)CHAR_BASE_BLOCK_SUB(2), 0, &decompressBiosCallback);
		vramcpy_ui (&BG_PALETTE[0], topErrorPal, topErrorPalLen);
		vramcpy_ui (&BG_PALETTE_SUB[0], subErrorPal, subErrorPalLen);
	}

	while(1) { swiWaitForVBlank(); }
}