void __cdecl LoadReferencedBanners(){ // replaces sub_42B9E0 char szPath[MAX_PATH]; memset( Loaded_Banner_Array, 0, sizeof( Loaded_Banner_Array ) ); sub_004338D0( *((DWORD*)0x005014BC), 0xA0, 0x004D6EC0, 8, 0x00526D20, (*((DWORD*)0x00501AAC) & 0x10) ); int loaded_count = 0; for( int i = BANNER_FIRST; i <= BANNER_LAST; i++ ){ if( SpriteTable[i].ref_count != 0 ){ // load banner if used wsprintfA( szPath, "[BANNERS]\\%s.spr", SpriteTable[i].name ); LoadBanner( *((DWORD*)0x00526D20), szPath, &Loaded_Banner_Array[loaded_count], 1, 1, (*((DWORD*)0x00501AAC) & 0x10) ); if( Loaded_Banner_Array[loaded_count] != 0 ) { sub_00435340( *((DWORD*)0x005014BC), 4, Loaded_Banner_Array[loaded_count], *((DWORD*)0x00526D20), 0, 0, 4, 0 ); sub_00435340( *((DWORD*)0x005014BC), 0, Loaded_Banner_Array[loaded_count], *((DWORD*)0x00526D20), 1, 1, 4, 0 ); SpriteTable[i].loaded_index_banners = (WORD)loaded_count; loaded_count++; } } } for( int i = X_BANNER_FIRST; i <= X_BANNER_LAST; i++ ){ if( SpriteTable[i].ref_count != 0 ){ // load banner if used wsprintfA( szPath, "[BANNERS]\\%s.spr", SpriteTable[i].name ); LoadBanner( *((DWORD*)0x00526D20), szPath, &Loaded_Banner_Array[loaded_count], 1, 1, (*((DWORD*)0x00501AAC) & 0x10) ); if( Loaded_Banner_Array[loaded_count] != 0 ) { sub_00435340( *((DWORD*)0x005014BC), 4, Loaded_Banner_Array[loaded_count], *((DWORD*)0x00526D20), 0, 0, 4, 0 ); sub_00435340( *((DWORD*)0x005014BC), 0, Loaded_Banner_Array[loaded_count], *((DWORD*)0x00526D20), 1, 1, 4, 0 ); SpriteTable[i].loaded_index_banners = (WORD)loaded_count; loaded_count++; } } } // load HUD wsprintfA( szPath, "[SPRITES]\\%s.spr", SpriteTable[HUD].name ); *((DWORD*)0x00526D28) = loaded_count; LoadBanner( *((DWORD*)0x00526D20), szPath, &Loaded_Banner_Array[loaded_count], 1, 1, (*((DWORD*)0x00501AAC) & 0x10) ); if( Loaded_Banner_Array[loaded_count] != 0 ){ sub_00435340( *((DWORD*)0x005014BC), 4, Loaded_Banner_Array[loaded_count], *((DWORD*)0x00526D20), 0x00, 0x00, 4, 0 ); sub_00435340( *((DWORD*)0x005014BC), 1, Loaded_Banner_Array[loaded_count], *((DWORD*)0x00526D20), 0x00, 0x01, 4, 0 ); sub_00435340( *((DWORD*)0x005014BC), 1, Loaded_Banner_Array[loaded_count], *((DWORD*)0x00526D20), 0x31, 0x31, 4, 0 ); sub_00435340( *((DWORD*)0x005014BC), 2, Loaded_Banner_Array[loaded_count], *((DWORD*)0x00526D20), 0x04, 0x23, 4, 0 ); sub_00435340( *((DWORD*)0x005014BC), 6, Loaded_Banner_Array[loaded_count], *((DWORD*)0x00526D20), 0x2C, 0x2F, 4, 0 ); sub_00435340( *((DWORD*)0x005014BC), 1, Loaded_Banner_Array[loaded_count], *((DWORD*)0x00526D20), 0x30, 0x30, 4, 0 ); sub_00435340( *((DWORD*)0x005014BC), 3, Loaded_Banner_Array[loaded_count], *((DWORD*)0x00526D20), 0x50, 0x67, 4, 0 ); sub_00435340( *((DWORD*)0x005014BC), 5, Loaded_Banner_Array[loaded_count], *((DWORD*)0x00526D20), 0x68, 0x71, 4, 0 ); sub_00435340( *((DWORD*)0x005014BC), 7, Loaded_Banner_Array[loaded_count], *((DWORD*)0x00526D20), 0x32, 0x40, 4, 0 ); SpriteTable[HUD].loaded_index_banners = (WORD)loaded_count; } }
/* We write the cache even if we won't use it, so we don't have to recache everything * if the memory or settings change. */ void BannerCache::CacheBanner( CString BannerPath ) { if( PREFSMAN->m_BannerCache != PrefsManager::BNCACHE_LOW_RES ) return; CHECKPOINT_M( BannerPath ); if( !DoesFileExist(BannerPath) ) return; const CString CachePath = GetBannerCachePath(BannerPath); /* Check the full file hash. If it's the loaded and identical, don't recache. */ if( DoesFileExist(CachePath) ) { unsigned CurFullHash; const unsigned FullHash = GetHashForFile( BannerPath ); if( BannerData.GetValue( BannerPath, "FullHash", CurFullHash ) && CurFullHash == FullHash ) { /* It's identical. Just load it. */ LoadBanner( BannerPath ); return; } } CacheBannerInternal( BannerPath ); }
JNIEXPORT jintArray JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetBanner(JNIEnv *env, jobject obj, jstring jFile) { const char *File = env->GetStringUTFChars(jFile, NULL); jintArray Banner = env->NewIntArray(DVD_BANNER_WIDTH * DVD_BANNER_HEIGHT); u32 uBanner[DVD_BANNER_WIDTH * DVD_BANNER_HEIGHT]; if (LoadBanner(File, uBanner)) { env->SetIntArrayRegion(Banner, 0, DVD_BANNER_WIDTH * DVD_BANNER_HEIGHT, (jint*)uBanner); } env->ReleaseStringUTFChars(jFile, File); return Banner; }
void MakeChar::Setup() { BAM_Guy *pGuy; BAM_Button *pButton; uchar *pback; CelHeader *pbackCH; int x; uint rNumBord; //====================================================== // setup background cel filled with black TRACK_MEM("MakeChar background cel"); gback = ACreateCel(&rNumBack,0,0,320,400,CI_BLACK,100); pback = AGetResData(gback); pbackCH = (CelHeader*)pback; // copy this anim into the dynamic cel that we will use gbackAnim = ALoad(RES_ANIM,8150); CopyCel(pbackCH,0,0,RES_ANIM,8150,1,FALSE); pGuy = &back; pGuy->SetRes(RES_CEL,rNumBack); pGuy->SetPos(0,0); pGuy->SetContext(gSelf); pGuy->Setup(CT_ROST); pGuy->SetPri(100); //pal.FadeToBlack(); pal.Load(8150); // pick a gender catagory switch (ARandom(3)) { case 0: bGlobal.curCat = G_MEN; break; case 1: bGlobal.curCat = G_WOMEN; break; case 2: bGlobal.curCat = G_OTHER; break; } //====================================================== // lets copy in all the borders and boundaries into the background gPortBord = ALoad(RES_ANIM,8154); rNumBord = 8154; CopyCel((CelHeader*)pback,108,67,RES_ANIM,rNumBord,3,TRUE); // Name Frame CopyCel((CelHeader*)pback,108,92,RES_ANIM,rNumBord,1,TRUE); // Portrait Frame CopyCel((CelHeader*)pback,157,92,RES_ANIM,rNumBord,4,TRUE); // Arrow Buttons Frame CopyCel((CelHeader*)pback,108,191,RES_ANIM,rNumBord,5,TRUE); // Gender Buttons Frame CopyCel((CelHeader*)pback,108,222,RES_ANIM,rNumBord,6,TRUE); // Name Buttons Frame CopyCel((CelHeader*)pback,108,253,RES_ANIM,rNumBord,7,TRUE); // 'Done' Button Frame CopyCel((CelHeader*)pback,21,281,RES_ANIM,rNumBord,10,TRUE); // Option Button Frame //============================================= // Write the necessary text into the background pFontMgr->SetRes(9050); SetFontColors(CI_SKIP,64,74); pTxt = sqbMakeChar.Load(MAKECHAR_SQB,1); ASetString(206, 99, pTxt, (uchar *)pbackCH, pbackCH->width, NULL); pTxt = sqbMakeChar.Load(MAKECHAR_SQB,2); ASetString(206, 116, pTxt, (uchar *)pbackCH, pbackCH->width, NULL); pTxt = sqbMakeChar.Load(MAKECHAR_SQB,3); ASetString(206, 133, pTxt, (uchar *)pbackCH, pbackCH->width, NULL); pTxt = sqbMakeChar.Load(MAKECHAR_SQB,4); ASetString(206, 150, pTxt, (uchar *)pbackCH, pbackCH->width, NULL); pTxt = sqbMakeChar.Load(MAKECHAR_SQB,5); ASetString( 70, 198, pTxt, (uchar *)pbackCH, pbackCH->width, NULL); pTxt = sqbMakeChar.Load(MAKECHAR_SQB,6); ASetString( 82, 229, pTxt, (uchar *)pbackCH, pbackCH->width, NULL); pFontMgr->SetRes(9052); SetFontColors(CI_SKIP,93,76,74,74,48,CI_BLACK); pTxt = sqbMakeChar.Load(MAKECHAR_SQB,7); pFontMgr->SetString(0,330, pTxt, (uchar *)pbackCH, pbackCH->width, NULL, DG_JUST_CENTER); SetFontColors(CI_SKIP,45,46,47,49,50,CI_BLACK); pTxt = sqbMakeChar.Load(MAKECHAR_SQB,8); pFontMgr->SetString(0,372, pTxt, (uchar *)pbackCH, pbackCH->width, NULL, DG_JUST_CENTER); pFontMgr->SetRes(9050); SetFontColors(CI_SKIP,64,74); switch(bGlobal.curCat) { case G_MEN: sqbRes = MEN_SQB; if(!maxMenNameNum) maxMenNameNum = atoi(sqbMakeChar.Load(MEN_SQB,1)); //add 2 to num to get zero based random num past first sqb used above curNameNum = MyRandom(maxMenNameNum,curNameNum) + 2; break; case G_WOMEN: sqbRes = WOMEN_SQB; if(!maxWomenNameNum) maxWomenNameNum = atoi(sqbMakeChar.Load(WOMEN_SQB,1)); curNameNum = MyRandom(maxWomenNameNum,curNameNum) + 2; break; case G_OTHER: sqbRes = OTHER_SQB; if(!maxOtherNameNum) maxOtherNameNum = atoi(sqbMakeChar.Load(OTHER_SQB,1)); curNameNum = MyRandom(maxOtherNameNum,curNameNum) + 2; break; } pTxt = sqbMakeChar.Load(sqbRes,curNameNum); TRACK_MEM("NameText"); gNameText = AMalloc(20); char *pText = ADerefAs(char, gNameText); strcpy(bGlobal.curName,pTxt); strcpy(pText,pTxt); BAM_Box *pBox = &nameBox; pBox->SetColors(CI_SKIP,64,74,64,74,64,74,155,142); pBox->Create(111, 71, 105, 15, 200, gNameText, 16, gSelf, rNumBack,0,0); pBox->SetupReplies(REPLY_DESELECTED); // let us know when text changes //pBox->Select(TRUE); //makes the box edit active //====================================================== // setup current portrait -randomly init. LoadCover(); LoadFace(); LoadBody(); LoadBanner(); //====================================================== // lets setup up all the buttons uint32 posY[4] = { 95, 112, 129, 146 }; for(x=0; x<4; x++) { // create left arrow button pButton = &leftArrowB[x]; pButton->Create(159, posY[x], 200, RES_ANIM, 8156, 1, gSelf); pButton->SetupReplies(REPLY_DESELECTED); pButton->fIsToggle = FALSE; // click-type button pButton->SetOwnerCel(rNumBack); // draws itself into this DCEL, instead of being drawn by Animate() directly pButton->Select(FALSE); // set button to unselected state - will cause drawing into master cel // create right arrow button pButton = &rightArrowB[x]; pButton->Create(180, posY[x], 200, RES_ANIM, 8157, 1, gSelf); pButton->SetupReplies(REPLY_DESELECTED); pButton->fIsToggle = FALSE; // click-type button pButton->SetOwnerCel(rNumBack); // draws itself into this DCEL, instead of being drawn by Animate() directly pButton->Select(FALSE); // set button to unselected state - will cause drawing into master cel } // disk button pButton = &diskB; pButton->Create(23, 285, 200, RES_ANIM, 129, 1, gSelf); pButton->SetupReplies(REPLY_DESELECTED); pButton->fIsToggle = FALSE; // click-type button pButton->SetOwnerCel(rNumBack); // draws itself into this DCEL, instead of being drawn by Animate() directly pButton->Select(FALSE); // set button to unselected state - will cause drawing into master cel pButton = &randomCharB; pButton->Create(159, 163, 200, RES_ANIM, 8158, 1, gSelf); pButton->SetupReplies(REPLY_DESELECTED); pButton->fIsToggle = FALSE; // click-type button pButton->SetOwnerCel(rNumBack); // draws itself into this DCEL, instead of being drawn by Animate() directly pButton->SetTextJustify(DG_JUST_CENTER, DG_JUST_CENTER); pTxt = sqbMakeChar.Load(MAKECHAR_SQB,9); pButton->SetCelText(1, pTxt); pButton->SetColors(1, 93, 90); // inactive colors pButton->SetCelText(2, pTxt); pButton->SetColors(2, 155, 142); // active colors pButton->Draw(); pButton->Select(FALSE); // set button to unselected state - will cause drawing into master cel pButton = &manB; pButton->Create(110, 194, 200, RES_ANIM, 8158, 1, gSelf); pButton->SetupReplies(REPLY_ACTIVATED | REPLY_DEACTIVATED); pButton->fIsToggle = TRUE; // click-type button pButton->SetOwnerCel(rNumBack); // draws itself into this DCEL, instead of being drawn by Animate() directly pButton->SetTextJustify(DG_JUST_CENTER, DG_JUST_CENTER); pTxt = sqbMakeChar.Load(MAKECHAR_SQB,10); pButton->SetCelText(1, pTxt); pButton->SetColors(1, 93, 90); // inactive colors pButton->SetCelText(2, pTxt); pButton->SetColors(2, 155, 142); // active colors pButton->Draw(); if(bGlobal.curCat == G_MEN) pButton->Select(TRUE); // set button to unselected state - will cause drawing into master cel else pButton->Select(FALSE); // set button to unselected state - will cause drawing into master cel pButton = &womanB; pButton->Create(152, 194, 200, RES_ANIM, 8158, 1, gSelf); pButton->SetupReplies(REPLY_ACTIVATED | REPLY_DEACTIVATED); pButton->fIsToggle = TRUE; // click-type button pButton->SetOwnerCel(rNumBack); // draws itself into this DCEL, instead of being drawn by Animate() directly pButton->SetTextJustify(DG_JUST_CENTER, DG_JUST_CENTER); pTxt = sqbMakeChar.Load(MAKECHAR_SQB,11); pButton->SetCelText(1, pTxt); pButton->SetColors(1, 93, 90); // inactive colors pButton->SetCelText(2, pTxt); pButton->SetColors(2, 155, 142); // active colors pButton->Draw(); if(bGlobal.curCat == G_WOMEN) pButton->Select(TRUE); // set button to unselected state - will cause drawing into master cel else pButton->Select(FALSE); // set button to unselected state - will cause drawing into master cel pButton = &otherB; pButton->Create(194, 194, 200, RES_ANIM, 8158, 1, gSelf); pButton->SetupReplies(REPLY_ACTIVATED | REPLY_DEACTIVATED); pButton->fIsToggle = TRUE; // click-type button pButton->SetOwnerCel(rNumBack); // draws itself into this DCEL, instead of being drawn by Animate() directly pButton->SetTextJustify(DG_JUST_CENTER, DG_JUST_CENTER); pTxt = sqbMakeChar.Load(MAKECHAR_SQB,12); pButton->SetCelText(1, pTxt); pButton->SetColors(1, 93, 90); // inactive colors pButton->SetCelText(2, pTxt); pButton->SetColors(2, 155, 142); // active colors pButton->Draw(); if(bGlobal.curCat == G_OTHER) pButton->Select(TRUE); // set button to unselected state - will cause drawing into master cel else pButton->Select(FALSE); // set button to unselected state - will cause drawing into master cel pButton = &customNameB; pButton->Create(110, 225, 200, RES_ANIM, 8158, 1, gSelf); pButton->SetupReplies(REPLY_DESELECTED); pButton->fIsToggle = FALSE; // click-type button pButton->SetOwnerCel(rNumBack); // draws itself into this DCEL, instead of being drawn by Animate() directly pButton->SetTextJustify(DG_JUST_CENTER, DG_JUST_CENTER); pTxt = sqbMakeChar.Load(MAKECHAR_SQB,13); pButton->SetCelText(1, pTxt); pButton->SetColors(1, 93, 90); // inactive colors pButton->SetCelText(2, pTxt); pButton->SetColors(2, 155, 142); // active colors pButton->Draw(); pButton->Select(FALSE); // set button to unselected state - will cause drawing into master cel pButton = &randomNameB; pButton->Create(152, 225, 200, RES_ANIM, 8158, 1, gSelf); pButton->SetupReplies(REPLY_DESELECTED); pButton->fIsToggle = FALSE; // click-type button pButton->SetOwnerCel(rNumBack); // draws itself into this DCEL, instead of being drawn by Animate() directly pButton->SetTextJustify(DG_JUST_CENTER, DG_JUST_CENTER); pTxt = sqbMakeChar.Load(MAKECHAR_SQB,9); pButton->SetCelText(1, pTxt); pButton->SetColors(1, 93, 90); // inactive colors pButton->SetCelText(2, pTxt); pButton->SetColors(2, 155, 142); // active colors pButton->Draw(); pButton->Select(FALSE); // set button to unselected state - will cause drawing into master cel pButton = &doneB; pButton->Create(110, 256, 200, RES_ANIM, 8158, 1, gSelf); pButton->SetupReplies(REPLY_DESELECTED); pButton->fIsToggle = FALSE; // click-type button pButton->SetOwnerCel(rNumBack); // draws itself into this DCEL, instead of being drawn by Animate() directly pButton->SetTextJustify(DG_JUST_CENTER, DG_JUST_CENTER); pTxt = sqbMakeChar.Load(MAKECHAR_SQB,14); pButton->SetCelText(1, pTxt); pButton->SetColors(1, 93, 90); // inactive colors pButton->SetCelText(2, pTxt); pButton->SetColors(2, 155, 142); // active colors pButton->Draw(); pButton->Select(FALSE); // set button to unselected state - will cause drawing into master cel BAM_Room::Setup(); pGraphMgr->Animate(); pal.FadeUp(); }