Removing the GuiElements properly. Fixes compatibility with libs

This commit is contained in:
Maschell 2017-11-11 16:11:24 +01:00
parent 3041cc7103
commit aa3849b31f
13 changed files with 40 additions and 32 deletions

View File

@ -5,6 +5,7 @@
#include <controller_patcher/ControllerPatcher.hpp> #include <controller_patcher/ControllerPatcher.hpp>
#include <dynamic_libs/os_functions.h> #include <dynamic_libs/os_functions.h>
#include <dynamic_libs/fs_functions.h>
#include <dynamic_libs/ax_functions.h> #include <dynamic_libs/ax_functions.h>
#include <dynamic_libs/gx2_functions.h> #include <dynamic_libs/gx2_functions.h>
#include <dynamic_libs/syshid_functions.h> #include <dynamic_libs/syshid_functions.h>
@ -17,7 +18,7 @@
#include <fs/FSUtils.h> #include <fs/FSUtils.h>
#include <fs/sd_fat_devoptab.h> #include <fs/sd_fat_devoptab.h>
#include <system/memory.h> #include <system/memory.h>
#include <kernel/kernel_functions.h> #include <system/exception_handler.h>
#include <language/gettext.h> #include <language/gettext.h>
#include <utils/StringTools.h> #include <utils/StringTools.h>
@ -44,6 +45,8 @@ extern "C" s32 Menu_Main(void){
InitVPadFunctionPointers(); InitVPadFunctionPointers();
InitProcUIFunctionPointers(); InitProcUIFunctionPointers();
setup_os_exceptions();
if(OSGetTitleID() == 0x00050000101a5f00L || // Shantae and the Pirate's Curse USA (reason: crashes when pressing HOME, Pro Controller not recognized) if(OSGetTitleID() == 0x00050000101a5f00L || // Shantae and the Pirate's Curse USA (reason: crashes when pressing HOME, Pro Controller not recognized)
OSGetTitleID() == 0x00050000101F7F00L || // Shantae and the Pirate's Curse JAP (シャンティ -海賊の呪い-) (reason: crashes when pressing HOME, Pro Controller not recognized) OSGetTitleID() == 0x00050000101F7F00L || // Shantae and the Pirate's Curse JAP (シャンティ -海賊の呪い-) (reason: crashes when pressing HOME, Pro Controller not recognized)
OSGetTitleID() == 0x00050000101a9500L){ // Shantae and the Pirate's Curse EUR (reason: crashes when pressing HOME, Pro Controller not recognized) OSGetTitleID() == 0x00050000101a9500L){ // Shantae and the Pirate's Curse EUR (reason: crashes when pressing HOME, Pro Controller not recognized)
@ -65,8 +68,6 @@ extern "C" s32 Menu_Main(void){
InitPadScoreFunctionPointers(); InitPadScoreFunctionPointers();
InitAXFunctionPointers(); InitAXFunctionPointers();
SetupKernelCallback();
log_init(); log_init();
DEBUG_FUNCTION_LINE("HID to VPAD %s - %s %s - by Maschell\n\n",APP_VERION,__DATE__,__TIME__); DEBUG_FUNCTION_LINE("HID to VPAD %s - %s %s - by Maschell\n\n",APP_VERION,__DATE__,__TIME__);

View File

@ -35,7 +35,6 @@ MainWindowContent::MainWindowContent(s32 w, s32 h)
bgImageColor.setImageColor((GX2Color){ 248, 249, 248, 255 }, 2); bgImageColor.setImageColor((GX2Color){ 248, 249, 248, 255 }, 2);
bgImageColor.setImageColor((GX2Color){ 248, 249, 248, 255 }, 3); bgImageColor.setImageColor((GX2Color){ 248, 249, 248, 255 }, 3);
homebutton_img.setPosition(-70,0); homebutton_img.setPosition(-70,0);
exitHome.setPosition(60,0); exitHome.setPosition(60,0);
@ -80,7 +79,6 @@ void MainWindowContent::SetScreen(ContentTemplate * new_content){
RemoveScreen(); RemoveScreen();
if(new_content){ if(new_content){
//while(content != NULL); //hopefully this shit don't kill us. //while(content != NULL); //hopefully this shit don't kill us.
content = new_content; content = new_content;
append(content); append(content);
@ -89,6 +87,7 @@ void MainWindowContent::SetScreen(ContentTemplate * new_content){
} }
void MainWindowContent::RemoveScreen(){ void MainWindowContent::RemoveScreen(){
DEBUG_FUNCTION_LINE("%08X\n",content);
remove(content); remove(content);
delete content; delete content;
content = NULL; content = NULL;
@ -101,5 +100,8 @@ void MainWindowContent::OnCloseEffectFinish(GuiElement *element){
MainWindowContent::~MainWindowContent(){ MainWindowContent::~MainWindowContent(){
remove(&footerFrame); remove(&footerFrame);
remove(&bgImageColor); remove(&bgImageColor);
Resources::RemoveImageData(footer_imgdata);
Resources::RemoveImageData(homebutton_imgdata);
Resources::RemoveImageData(plusbutton_imgdata);
RemoveScreen(); RemoveScreen();
} }

View File

@ -70,7 +70,11 @@ void MainWindowDRC::process(){
} }
MainWindowDRC::~MainWindowDRC(){ MainWindowDRC::~MainWindowDRC(){
remove(&windowSplitter_img);
remove(&menuList); remove(&menuList);
remove(&content); remove(&content);
remove(&versionText);
remove(&ipAddress);
Resources::RemoveImageData(windowSplitter_imgdata);
} }

View File

@ -86,6 +86,16 @@ MenuListDRC::MenuListDRC(s32 w, s32 h,MainWindowContent * _contentWindow)
dpad_selection_changed = true; dpad_selection_changed = true;
} }
MenuListDRC::~MenuListDRC(){
remove(&bgImageColor);
remove(&VPADDrag);
remove(&DPADButtons);
for (std::vector<GuiElement*>::iterator it = listElementsAll.begin() ; it != listElementsAll.end(); ++it){
remove(*it);
}
}
void MenuListDRC::setState(s32 i, s32 c){ void MenuListDRC::setState(s32 i, s32 c){
GuiFrame::setState(i,c); GuiFrame::setState(i,c);
@ -246,20 +256,3 @@ MenuElement * MenuListDRC::getButtonElementByController(UController_Type control
default: return NULL; default: return NULL;
} }
} }
MenuListDRC::~MenuListDRC(){
remove(&bgImageColor);
remove(&homeSeperator);
remove(&elementHome);
remove(&controllerSeperator);
remove(&elementGamePad);
remove(&elementProController1);
remove(&elementProController2);
remove(&elementProController3);
remove(&elementProController4);
remove(&otherSeperator);
remove(&elementNetworkHelp);
remove(&elementHelp);
remove(&elementSettings);
remove(&elementAbout);
}

View File

@ -161,7 +161,6 @@ ContentAbout::ContentAbout(): ContentTemplate(){
} }
ContentAbout::~ContentAbout(){ ContentAbout::~ContentAbout(){
remove(&bgImageColor);
remove(&headLine); remove(&headLine);
for(u32 i = 0; i < aboutText.size(); ++i){ for(u32 i = 0; i < aboutText.size(); ++i){
remove(aboutText[i]); remove(aboutText[i]);

View File

@ -140,8 +140,11 @@ ContentController::ContentController(UController_Type controller_type_): Content
} }
ContentController::~ContentController(){ ContentController::~ContentController(){
remove(&bgImageColor);
remove(&headLine); remove(&headLine);
remove(&notConnectedFrame);
remove(&connectedFrame);
remove(&DPADButtons);
Resources::RemoveImageData(not_connected_imgdata);
} }
UController_Type ContentController::getControllerType(){ UController_Type ContentController::getControllerType(){

View File

@ -130,7 +130,6 @@ ContentHelp::ContentHelp(): ContentTemplate(){
} }
ContentHelp::~ContentHelp(){ ContentHelp::~ContentHelp(){
remove(&bgImageColor);
remove(&headLine); remove(&headLine);
for(u32 i = 0; i < helpText.size(); ++i){ for(u32 i = 0; i < helpText.size(); ++i){

View File

@ -87,15 +87,19 @@ ContentHome::ContentHome():ContentTemplate()
} }
ContentHome::~ContentHome(){ ContentHome::~ContentHome(){
//Resources::RemoveImageData(logoImageData); <-- will reduce lag. Will be deleted at the end anyway // will reduce lag. Will be deleted at the end anyway
remove(&bgImageColor); Resources::RemoveImageData(logoImageData);
remove(&logoImage); Resources::RemoveImageData(twitterLogoImageData);
Resources::RemoveImageData(githubLogoImageData);
remove(&welcomeHeadLineLabel); remove(&welcomeHeadLineLabel);
remove(&welcomeTextLabel); remove(&welcomeTextLabel);
remove(&welcomeTextLabel2); remove(&welcomeTextLabel2);
remove(&welcomeTextLabel3); remove(&welcomeTextLabel3);
remove(&logoImage);
remove(&twitterLogoImage); remove(&twitterLogoImage);
remove(&githubLogoImage); remove(&githubLogoImage);
remove(&twitterLabel); remove(&twitterLabel);
remove(&URLLabel); remove(&URLLabel);
remove(&URL2Label); remove(&URL2Label);

View File

@ -180,7 +180,6 @@ ContentNetworkHelp::ContentNetworkHelp(): ContentTemplate(){
} }
ContentNetworkHelp::~ContentNetworkHelp(){ ContentNetworkHelp::~ContentNetworkHelp(){
remove(&bgImageColor);
remove(&headLine); remove(&headLine);
for(u32 i = 0; i < helpText.size(); ++i){ for(u32 i = 0; i < helpText.size(); ++i){

View File

@ -135,6 +135,7 @@ ContentSettings::ContentSettings():ContentTemplate()
ContentSettings::~ContentSettings(){ ContentSettings::~ContentSettings(){
remove(&headLine); remove(&headLine);
remove(&settingsFrame);
Resources::RemoveSound(buttonClickSound); Resources::RemoveSound(buttonClickSound);
if(bChanged){ if(bChanged){

View File

@ -40,7 +40,7 @@ public:
append(&bgImageColor); append(&bgImageColor);
} }
virtual ~ContentTemplate() {} virtual ~ContentTemplate() {remove(&bgImageColor);}
protected: protected:
GuiImage bgImageColor; GuiImage bgImageColor;
}; };

View File

@ -76,6 +76,7 @@ MainWindowTV::~MainWindowTV()
remove(&controllerConfigurationTV); remove(&controllerConfigurationTV);
remove(&twitterLogoImage); remove(&twitterLogoImage);
remove(&logoImage); remove(&logoImage);
remove(&githubLogoImage);
remove(&twitterLabel); remove(&twitterLabel);
remove(&githubLabel); remove(&githubLabel);
remove(&backgroundImage); remove(&backgroundImage);

View File

@ -111,7 +111,9 @@ TVControllerBanner::~TVControllerBanner(){
remove(&proController2); remove(&proController2);
remove(&proController3); remove(&proController3);
remove(&proController4); remove(&proController4);
remove(&homebutton_img); remove(&gamepad);
remove(&exitHomeFrame);
remove(&exitPlusFrame);
} }
void TVControllerBanner::OnButtonClicked(GuiButton *button, const GuiController *controller, GuiTrigger *trigger){ void TVControllerBanner::OnButtonClicked(GuiButton *button, const GuiController *controller, GuiTrigger *trigger){