mirror of
https://github.com/wiiu-env/WiiUPluginLoaderGUI.git
synced 2024-11-22 09:09:17 +01:00
Formatting
This commit is contained in:
parent
9442c5d62a
commit
16fb3a7080
@ -187,7 +187,7 @@ void Application::executeThread(void) {
|
||||
bool result = linkPluginsCallback();
|
||||
if(!result) {
|
||||
// On linking errors return to the HBL.
|
||||
#warning TODO: proper error handling when linking fails.
|
||||
#warning TODO: proper error handling when linking fails.
|
||||
exitCode = APPLICATION_CLOSE_MIIMAKER;
|
||||
}
|
||||
}
|
||||
|
@ -20,16 +20,15 @@
|
||||
*/
|
||||
|
||||
DefaultGuiSelectBox::DefaultGuiSelectBox(std::string caption, GuiFrame *parent)
|
||||
: GuiSelectBox(NULL,caption)
|
||||
,topBackgroundImg_imgdata(Resources::GetImageData("gameSettingsButton.png"))
|
||||
,topBackgroundImg_img(topBackgroundImg_imgdata)
|
||||
,topHighlightedImg_imgdata(Resources::GetImageData("gameSettingsButtonSelected.png"))
|
||||
,topHighlightedImg_img(topHighlightedImg_imgdata)
|
||||
,valueImageData(Resources::GetImageData("gameSettingsButtonEx.png"))
|
||||
,valueSelectedImageData(Resources::GetImageData("gameSettingsButtonExSelected.png"))
|
||||
,valueHighlightedImageData(Resources::GetImageData("gameSettingsButtonExHighlighted.png"))
|
||||
,buttonClickSound(Resources::GetSound("settings_click_2.mp3"))
|
||||
{
|
||||
: GuiSelectBox(NULL,caption)
|
||||
,topBackgroundImg_imgdata(Resources::GetImageData("gameSettingsButton.png"))
|
||||
,topBackgroundImg_img(topBackgroundImg_imgdata)
|
||||
,topHighlightedImg_imgdata(Resources::GetImageData("gameSettingsButtonSelected.png"))
|
||||
,topHighlightedImg_img(topHighlightedImg_imgdata)
|
||||
,valueImageData(Resources::GetImageData("gameSettingsButtonEx.png"))
|
||||
,valueSelectedImageData(Resources::GetImageData("gameSettingsButtonExSelected.png"))
|
||||
,valueHighlightedImageData(Resources::GetImageData("gameSettingsButtonExHighlighted.png"))
|
||||
,buttonClickSound(Resources::GetSound("settings_click_2.mp3")) {
|
||||
setSize(topBackgroundImg_img.getWidth(),topBackgroundImg_img.getHeight());
|
||||
this->setImageTopBackground(&topBackgroundImg_img);
|
||||
this->setImageTopHighlighted(&topHighlightedImg_img);
|
||||
@ -41,8 +40,7 @@ DefaultGuiSelectBox::DefaultGuiSelectBox(std::string caption, GuiFrame *parent)
|
||||
/**
|
||||
* Destructor for the DefaultGuiSelectBox class.
|
||||
*/
|
||||
DefaultGuiSelectBox::~DefaultGuiSelectBox()
|
||||
{
|
||||
DefaultGuiSelectBox::~DefaultGuiSelectBox() {
|
||||
Resources::RemoveImageData(topBackgroundImg_imgdata);
|
||||
Resources::RemoveImageData(topHighlightedImg_imgdata);
|
||||
Resources::RemoveImageData(valueImageData);
|
||||
|
@ -20,26 +20,26 @@
|
||||
#include <gui/GuiSelectBox.h>
|
||||
|
||||
//!A simple select box with default values.
|
||||
class DefaultGuiSelectBox : public GuiSelectBox{
|
||||
public:
|
||||
//!Constructor
|
||||
//!\param checked Checked
|
||||
DefaultGuiSelectBox(std::string caption, GuiFrame *parent = NULL);
|
||||
//!Destructor
|
||||
virtual ~DefaultGuiSelectBox();
|
||||
class DefaultGuiSelectBox : public GuiSelectBox {
|
||||
public:
|
||||
//!Constructor
|
||||
//!\param checked Checked
|
||||
DefaultGuiSelectBox(std::string caption, GuiFrame *parent = NULL);
|
||||
//!Destructor
|
||||
virtual ~DefaultGuiSelectBox();
|
||||
|
||||
protected:
|
||||
GuiImageData * topBackgroundImg_imgdata;
|
||||
GuiImage topBackgroundImg_img;
|
||||
protected:
|
||||
GuiImageData * topBackgroundImg_imgdata;
|
||||
GuiImage topBackgroundImg_img;
|
||||
|
||||
GuiImageData * topHighlightedImg_imgdata;
|
||||
GuiImage topHighlightedImg_img;
|
||||
GuiImageData * topHighlightedImg_imgdata;
|
||||
GuiImage topHighlightedImg_img;
|
||||
|
||||
GuiImageData * valueImageData;
|
||||
GuiImageData * valueSelectedImageData;
|
||||
GuiImageData * valueHighlightedImageData;
|
||||
GuiImageData * valueImageData;
|
||||
GuiImageData * valueSelectedImageData;
|
||||
GuiImageData * valueHighlightedImageData;
|
||||
|
||||
GuiSound * buttonClickSound;
|
||||
GuiSound * buttonClickSound;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -20,16 +20,15 @@
|
||||
*/
|
||||
|
||||
DefaultGuiSwitch::DefaultGuiSwitch(bool checked)
|
||||
: GuiSwitch(NULL,checked)
|
||||
,switchbase_imgdata(Resources::GetImageData("switchIconBase.png"))
|
||||
,switchbase_img(switchbase_imgdata)
|
||||
,switchbase_highlighted_imgdata(Resources::GetImageData("switchIconBaseHighlighted.png"))
|
||||
,switchbase_highlighted_img(switchbase_highlighted_imgdata)
|
||||
,switchOn_imgdata(Resources::GetImageData("switchIconOn.png"))
|
||||
,switchOn_img(switchOn_imgdata)
|
||||
,switchOff_imgdata(Resources::GetImageData("switchIconOff.png"))
|
||||
,switchOff_img(switchOff_imgdata)
|
||||
{
|
||||
: GuiSwitch(NULL,checked)
|
||||
,switchbase_imgdata(Resources::GetImageData("switchIconBase.png"))
|
||||
,switchbase_img(switchbase_imgdata)
|
||||
,switchbase_highlighted_imgdata(Resources::GetImageData("switchIconBaseHighlighted.png"))
|
||||
,switchbase_highlighted_img(switchbase_highlighted_imgdata)
|
||||
,switchOn_imgdata(Resources::GetImageData("switchIconOn.png"))
|
||||
,switchOn_img(switchOn_imgdata)
|
||||
,switchOff_imgdata(Resources::GetImageData("switchIconOff.png"))
|
||||
,switchOff_img(switchOff_imgdata) {
|
||||
setSize(switchbase_img.getWidth(),switchbase_img.getHeight());
|
||||
this->setImageBackground(&switchbase_img);
|
||||
this->setImageHighlighted(&switchbase_highlighted_img);
|
||||
@ -39,8 +38,7 @@ DefaultGuiSwitch::DefaultGuiSwitch(bool checked)
|
||||
/**
|
||||
* Destructor for the DefaultGuiSwitch class.
|
||||
*/
|
||||
DefaultGuiSwitch::~DefaultGuiSwitch()
|
||||
{
|
||||
DefaultGuiSwitch::~DefaultGuiSwitch() {
|
||||
Resources::RemoveImageData(switchbase_imgdata);
|
||||
Resources::RemoveImageData(switchbase_highlighted_imgdata);
|
||||
Resources::RemoveImageData(switchOn_imgdata);
|
||||
|
@ -20,26 +20,26 @@
|
||||
#include <gui/GuiSwitch.h>
|
||||
|
||||
//!A simple switch
|
||||
class DefaultGuiSwitch : public GuiSwitch{
|
||||
public:
|
||||
//!Constructor
|
||||
//!\param checked Checked
|
||||
DefaultGuiSwitch(bool checked);
|
||||
//!Destructor
|
||||
virtual ~DefaultGuiSwitch();
|
||||
class DefaultGuiSwitch : public GuiSwitch {
|
||||
public:
|
||||
//!Constructor
|
||||
//!\param checked Checked
|
||||
DefaultGuiSwitch(bool checked);
|
||||
//!Destructor
|
||||
virtual ~DefaultGuiSwitch();
|
||||
|
||||
protected:
|
||||
GuiImageData * switchbase_imgdata = NULL;
|
||||
GuiImage switchbase_img;
|
||||
protected:
|
||||
GuiImageData * switchbase_imgdata = NULL;
|
||||
GuiImage switchbase_img;
|
||||
|
||||
GuiImageData * switchbase_highlighted_imgdata = NULL;
|
||||
GuiImage switchbase_highlighted_img;
|
||||
GuiImageData * switchbase_highlighted_imgdata = NULL;
|
||||
GuiImage switchbase_highlighted_img;
|
||||
|
||||
GuiImageData * switchOn_imgdata = NULL;
|
||||
GuiImage switchOn_img;
|
||||
GuiImageData * switchOn_imgdata = NULL;
|
||||
GuiImage switchOn_img;
|
||||
|
||||
GuiImageData * switchOff_imgdata = NULL;
|
||||
GuiImage switchOff_img;
|
||||
GuiImageData * switchOff_imgdata = NULL;
|
||||
GuiImage switchOff_img;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -148,7 +148,7 @@ extern "C" int32_t Menu_Main(int32_t argc, char **argv) {
|
||||
g_vid_originalContextSave = NULL;
|
||||
g_vid_ownContextState = NULL;
|
||||
g_NotInLoader = false;
|
||||
}else{
|
||||
} else {
|
||||
g_NotInLoader = true;
|
||||
}
|
||||
|
||||
|
@ -231,7 +231,7 @@ bool ContentHome::linkPlugins() {
|
||||
|
||||
void ContentHome::update(GuiController * c) {
|
||||
ContentTemplate::update(c);
|
||||
if(updateButtons){
|
||||
if(updateButtons) {
|
||||
for (auto const& x : selectionMapping) {
|
||||
int index = x.first;
|
||||
GuiToggle* toggle = x.second;
|
||||
|
@ -8,20 +8,17 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct _sr_table_t
|
||||
{
|
||||
typedef struct _sr_table_t {
|
||||
uint32_t value[16];
|
||||
uint32_t sdr1;
|
||||
} sr_table_t;
|
||||
|
||||
typedef struct _bat_t
|
||||
{
|
||||
typedef struct _bat_t {
|
||||
uint32_t h;
|
||||
uint32_t l;
|
||||
} bat_t;
|
||||
|
||||
typedef struct _bat_table_t
|
||||
{
|
||||
typedef struct _bat_table_t {
|
||||
bat_t bat[8];
|
||||
} bat_table_t;
|
||||
|
||||
|
@ -58,22 +58,23 @@ static void KernelWriteSRs(sr_table_t * table) {
|
||||
// Writing didn't work for all at once so we only write number 8.
|
||||
// TODO: fix this and change it if required.
|
||||
|
||||
/*asm volatile("mtsr 0, %0" : : "r" (table->value[i])); i++;
|
||||
asm volatile("mtsr 1, %0" : : "r" (table->value[i])); i++;
|
||||
asm volatile("mtsr 2, %0" : : "r" (table->value[i])); i++;
|
||||
asm volatile("mtsr 3, %0" : : "r" (table->value[i])); i++;
|
||||
asm volatile("mtsr 4, %0" : : "r" (table->value[i])); i++;
|
||||
asm volatile("mtsr 5, %0" : : "r" (table->value[i])); i++;*/
|
||||
//asm volatile("mtsr 6, %0" : : "r" (table->value[6])); i++;
|
||||
/*asm volatile("mtsr 7, %0" : : "r" (table->value[i])); i++;*/
|
||||
asm volatile("mtsr 8, %0" : : "r" (table->value[8])); i++;
|
||||
/*asm volatile("mtsr 9, %0" : : "r" (table->value[i])); i++;
|
||||
asm volatile("mtsr 10, %0" : : "r" (table->value[i])); i++;
|
||||
asm volatile("mtsr 11, %0" : : "r" (table->value[i])); i++;
|
||||
asm volatile("mtsr 12, %0" : : "r" (table->value[i])); i++;
|
||||
asm volatile("mtsr 13, %0" : : "r" (table->value[i])); i++;
|
||||
asm volatile("mtsr 14, %0" : : "r" (table->value[i])); i++;
|
||||
asm volatile("mtsr 15, %0" : : "r" (table->value[i])); i++;*/
|
||||
/*asm volatile("mtsr 0, %0" : : "r" (table->value[i])); i++;
|
||||
asm volatile("mtsr 1, %0" : : "r" (table->value[i])); i++;
|
||||
asm volatile("mtsr 2, %0" : : "r" (table->value[i])); i++;
|
||||
asm volatile("mtsr 3, %0" : : "r" (table->value[i])); i++;
|
||||
asm volatile("mtsr 4, %0" : : "r" (table->value[i])); i++;
|
||||
asm volatile("mtsr 5, %0" : : "r" (table->value[i])); i++;*/
|
||||
//asm volatile("mtsr 6, %0" : : "r" (table->value[6])); i++;
|
||||
/*asm volatile("mtsr 7, %0" : : "r" (table->value[i])); i++;*/
|
||||
asm volatile("mtsr 8, %0" : : "r" (table->value[8]));
|
||||
i++;
|
||||
/*asm volatile("mtsr 9, %0" : : "r" (table->value[i])); i++;
|
||||
asm volatile("mtsr 10, %0" : : "r" (table->value[i])); i++;
|
||||
asm volatile("mtsr 11, %0" : : "r" (table->value[i])); i++;
|
||||
asm volatile("mtsr 12, %0" : : "r" (table->value[i])); i++;
|
||||
asm volatile("mtsr 13, %0" : : "r" (table->value[i])); i++;
|
||||
asm volatile("mtsr 14, %0" : : "r" (table->value[i])); i++;
|
||||
asm volatile("mtsr 15, %0" : : "r" (table->value[i])); i++;*/
|
||||
|
||||
|
||||
asm volatile("isync");
|
||||
@ -87,7 +88,7 @@ void KernelReadPTE(uint32_t* dest, uint32_t size) {
|
||||
asm volatile("mfmsr %0" : "=r" (msr));
|
||||
oldmsr = msr;
|
||||
msr &= ~0x10;
|
||||
for(uint32_t i = 0;i<size/0x04;i++){
|
||||
for(uint32_t i = 0; i<size/0x04; i++) {
|
||||
uint32_t value_read = 0;
|
||||
uint32_t addr = addr_base + (i*4);
|
||||
// Disable Data address translation
|
||||
@ -107,7 +108,7 @@ void KernelWritePTE(uint32_t * in_addr, uint32_t size) {
|
||||
asm volatile("mfmsr %0" : "=r" (msr));
|
||||
oldmsr = msr;
|
||||
msr &= ~0x10;
|
||||
for(uint32_t i = 0;i<size/0x04;i++){
|
||||
for(uint32_t i = 0; i<size/0x04; i++) {
|
||||
uint32_t addr = addr_base + (i*4);
|
||||
uint32_t value = in_addr[i];
|
||||
// Disable Data address translation
|
||||
@ -135,7 +136,7 @@ void KernelWriteWitoutDAT(uint32_t addr, uint32_t value) {
|
||||
|
||||
void SC0x0A_KernelWriteWitoutDAT(uint32_t addr,uint32_t value);
|
||||
|
||||
void wups_init_kernel_syscalls(){
|
||||
void wups_init_kernel_syscalls() {
|
||||
//! assign 1 so that this variable gets into the retained .data section
|
||||
static uint8_t ucSyscallsSetupRequired = 1;
|
||||
if(!ucSyscallsSetupRequired)
|
||||
|
@ -683,24 +683,24 @@ bool MemoryMapping::mapMemory(uint32_t pa_start_address,uint32_t pa_end_address,
|
||||
return true;
|
||||
}
|
||||
|
||||
uint32_t MemoryMapping::PhysicalToEffective(uint32_t phyiscalAddress){
|
||||
uint32_t MemoryMapping::PhysicalToEffective(uint32_t phyiscalAddress) {
|
||||
uint32_t result = 0;
|
||||
const memory_values_t * curMemValues = NULL;
|
||||
int32_t curOffset = 0;
|
||||
//iterate through all own mapped memory regions
|
||||
for(int32_t i = 0;true;i++){
|
||||
if(mem_mapping[i].physical_addresses == NULL){
|
||||
for(int32_t i = 0; true; i++) {
|
||||
if(mem_mapping[i].physical_addresses == NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
curMemValues = mem_mapping[i].physical_addresses;
|
||||
uint32_t curOffsetInEA = 0;
|
||||
// iterate through all memory values of this region
|
||||
for(int32_t j= 0;true;j++){
|
||||
if(curMemValues[j].end_address == 0){
|
||||
for(int32_t j= 0; true; j++) {
|
||||
if(curMemValues[j].end_address == 0) {
|
||||
break;
|
||||
}
|
||||
if(phyiscalAddress >= curMemValues[j].start_address && phyiscalAddress < curMemValues[j].end_address){
|
||||
if(phyiscalAddress >= curMemValues[j].start_address && phyiscalAddress < curMemValues[j].end_address) {
|
||||
// calculate the EA
|
||||
result = (phyiscalAddress - curMemValues[j].start_address) + (mem_mapping[i].effective_start_address + curOffsetInEA);
|
||||
return result;
|
||||
@ -712,33 +712,33 @@ uint32_t MemoryMapping::PhysicalToEffective(uint32_t phyiscalAddress){
|
||||
return result;
|
||||
}
|
||||
|
||||
uint32_t MemoryMapping::EffectiveToPhysical(uint32_t effectiveAddress){
|
||||
uint32_t MemoryMapping::EffectiveToPhysical(uint32_t effectiveAddress) {
|
||||
uint32_t result = 0;
|
||||
// CAUTION: The data may be fragmented between multiple areas in PA.
|
||||
const memory_values_t * curMemValues = NULL;
|
||||
int32_t curOffset = 0;
|
||||
|
||||
for(int32_t i = 0;true;i++){
|
||||
if(mem_mapping[i].physical_addresses == NULL){
|
||||
for(int32_t i = 0; true; i++) {
|
||||
if(mem_mapping[i].physical_addresses == NULL) {
|
||||
break;
|
||||
}
|
||||
if(effectiveAddress >= mem_mapping[i].effective_start_address && effectiveAddress < mem_mapping[i].effective_end_address){
|
||||
if(effectiveAddress >= mem_mapping[i].effective_start_address && effectiveAddress < mem_mapping[i].effective_end_address) {
|
||||
curMemValues = mem_mapping[i].physical_addresses;
|
||||
curOffset = mem_mapping[i].effective_start_address;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(curMemValues == NULL){
|
||||
if(curMemValues == NULL) {
|
||||
return result;
|
||||
}
|
||||
|
||||
for(int32_t i= 0;true;i++){
|
||||
if(curMemValues[i].end_address == 0){
|
||||
for(int32_t i= 0; true; i++) {
|
||||
if(curMemValues[i].end_address == 0) {
|
||||
break;
|
||||
}
|
||||
int32_t curChunkSize = curMemValues[i].end_address - curMemValues[i].start_address;
|
||||
if(effectiveAddress < (curOffset + curChunkSize)){
|
||||
if(effectiveAddress < (curOffset + curChunkSize)) {
|
||||
result = (effectiveAddress - curOffset) + curMemValues[i].start_address;
|
||||
break;
|
||||
}
|
||||
|
@ -53,12 +53,12 @@ typedef struct _memory_mapping_t {
|
||||
#define MEMORY_START_PLUGIN_HEAP_END MEMORY_START_PLUGIN_HEAP + MEMORY_PLUGIN_HEAP_SIZE
|
||||
|
||||
const memory_values_t mem_vals_loader[] = {
|
||||
{0x28000000 + 0x06620000 , 0x28000000 + 0x06E20000}, // 8MB 0x80000000 0x80800000 -> 0x2E700000 0x2EF00000
|
||||
{0x28000000 + 0x06620000, 0x28000000 + 0x06E20000}, // 8MB 0x80000000 0x80800000 -> 0x2E700000 0x2EF00000
|
||||
{0,0}
|
||||
};
|
||||
|
||||
const memory_values_t mem_vals_plugins[] = {
|
||||
{0x28000000 + 0x06E20000 , 0x28000000 + 0x07E20000}, // 16MB 0x80800000 0x81800000 -> 0x2EF00000 0x2FF00000
|
||||
{0x28000000 + 0x06E20000, 0x28000000 + 0x07E20000}, // 16MB 0x80800000 0x81800000 -> 0x2EF00000 0x2FF00000
|
||||
{0,0}
|
||||
};
|
||||
|
||||
@ -85,7 +85,7 @@ const memory_values_t mem_vals_video[] = {
|
||||
// size += 0x20000; // value have to be a multiple of 0x20000;
|
||||
// }
|
||||
//
|
||||
{0x1A020000 , 0x1A020000 +0xE60000}, // size: 14720 kB
|
||||
{0x1A020000, 0x1A020000 +0xE60000}, // size: 14720 kB
|
||||
// The following chunk were empty while early tests and are maybe promising. However we can get 15mb from
|
||||
// a loader heap. Which should be enough for now.
|
||||
//{0x14000000 + 0x02E00000 , 0x14000000 +0x034E0000}, // size: 7040 kB
|
||||
|
@ -104,7 +104,7 @@ bool ConfigInformation::updateConfigSettings() {
|
||||
for (auto & curItem : curCat->getItems()) {
|
||||
std::string configID = curItem->getConfigID();
|
||||
std::string newValue = curItem->persistValue();
|
||||
if(this->configSettings->setValueAsString(this->configSettings->getIdByName(configID), newValue)){
|
||||
if(this->configSettings->setValueAsString(this->configSettings->getIdByName(configID), newValue)) {
|
||||
// When the value has changed, call the callback.
|
||||
DEBUG_FUNCTION_LINE("Called callback. Reason. Menu was closed and value has changed\n");
|
||||
curItem->callCallback();
|
||||
|
@ -166,19 +166,19 @@ void ConfigUtils::configMenuOpenedCallback(wups_overlay_options_type_t screen, v
|
||||
}
|
||||
if(vpad_data.btns_d & VPAD_BUTTON_RIGHT) {
|
||||
pressedButtons |= WUPS_CONFIG_BUTTON_RIGHT;
|
||||
}
|
||||
if(vpad_data.btns_d & VPAD_BUTTON_L) {
|
||||
}
|
||||
if(vpad_data.btns_d & VPAD_BUTTON_L) {
|
||||
pressedButtons |= WUPS_CONFIG_BUTTON_L;
|
||||
}
|
||||
if(vpad_data.btns_d & VPAD_BUTTON_R) {
|
||||
pressedButtons |= WUPS_CONFIG_BUTTON_R;
|
||||
}
|
||||
if(vpad_data.btns_d & VPAD_BUTTON_ZL) {
|
||||
if(vpad_data.btns_d & VPAD_BUTTON_ZL) {
|
||||
pressedButtons |= WUPS_CONFIG_BUTTON_ZL;
|
||||
}
|
||||
if(vpad_data.btns_d & VPAD_BUTTON_ZR) {
|
||||
pressedButtons |= WUPS_CONFIG_BUTTON_ZR;
|
||||
}
|
||||
}
|
||||
|
||||
if(vpad_data.btns_r & VPAD_BUTTON_DOWN) {
|
||||
newSelect++;
|
||||
@ -229,9 +229,9 @@ void ConfigUtils::configMenuOpenedCallback(wups_overlay_options_type_t screen, v
|
||||
if(!ignore && curSelect == inSelect) {
|
||||
if(curSelect == 0) {
|
||||
curScreenOffset = 0;
|
||||
}else if(cur_visible_rows + curScreenOffset >= visible_rows_range) {
|
||||
} else if(cur_visible_rows + curScreenOffset >= visible_rows_range) {
|
||||
curScreenOffset -= (cur_visible_rows + curScreenOffset) - visible_rows_range;
|
||||
}else if(cur_visible_rows + curScreenOffset < visible_rows_range/2 && cur_visible_rows >= visible_rows_range/2) {
|
||||
} else if(cur_visible_rows + curScreenOffset < visible_rows_range/2 && cur_visible_rows >= visible_rows_range/2) {
|
||||
curScreenOffset -= (cur_visible_rows + curScreenOffset) - visible_rows_range/2;
|
||||
}
|
||||
ignore = true;
|
||||
@ -343,27 +343,27 @@ void ConfigUtils::deleteConfigInformation(std::vector<ConfigInformation *> confi
|
||||
|
||||
void ConfigUtils::loadConfigFromSD() {
|
||||
std::vector<ConfigInformation *> configInfos = getConfigInformation();
|
||||
|
||||
|
||||
for (auto & curConfig : configInfos) {
|
||||
curConfig->loadValuesFromSD();
|
||||
}
|
||||
|
||||
|
||||
deleteConfigInformation(configInfos);
|
||||
}
|
||||
|
||||
void ConfigUtils::saveConfigToSD() {
|
||||
std::vector<ConfigInformation *> configInfos = getConfigInformation();
|
||||
|
||||
|
||||
for (auto & curConfig : configInfos) {
|
||||
curConfig->updateAndSaveSettings(true);
|
||||
}
|
||||
|
||||
|
||||
deleteConfigInformation(configInfos);
|
||||
}
|
||||
|
||||
void ConfigUtils::openConfigMenu() {
|
||||
std::vector<ConfigInformation *> configInfos = getConfigInformation();
|
||||
|
||||
|
||||
// We rely on the default values here.
|
||||
//if(loadFromSD){
|
||||
// for (auto & curConfig : configInfos) {
|
||||
@ -386,7 +386,7 @@ void ConfigUtils::openConfigMenu() {
|
||||
for (auto & curConfig : configs) {
|
||||
DCFlushRange(curConfig, sizeof(WUPSConfig));
|
||||
}
|
||||
|
||||
|
||||
for (auto & curConfig : configInfos) {
|
||||
curConfig->updateAndSaveSettings(false);
|
||||
}
|
||||
|
@ -29,10 +29,10 @@ public:
|
||||
and triggers the "callback" if they differ the default/current value.
|
||||
**/
|
||||
static void loadConfigFromSD();
|
||||
|
||||
/**
|
||||
Get the current values from all plugins via the WUPS_GET_CONFIG() hook and
|
||||
save them to the SD Card.
|
||||
|
||||
/**
|
||||
Get the current values from all plugins via the WUPS_GET_CONFIG() hook and
|
||||
save them to the SD Card.
|
||||
**/
|
||||
static void saveConfigToSD();
|
||||
|
||||
@ -72,7 +72,7 @@ private:
|
||||
default value. This behaviour may change in the future.
|
||||
See the ConfigInformation class for more information.
|
||||
**/
|
||||
static std::vector<ConfigInformation *> getConfigInformation();
|
||||
static std::vector<ConfigInformation *> getConfigInformation();
|
||||
|
||||
/**
|
||||
Delete a list of ConfigInformation.
|
||||
|
@ -24,14 +24,14 @@
|
||||
|
||||
int32_t memHandle __attribute__((section(".data"))) = -1;
|
||||
|
||||
void MemoryUtils::init(){
|
||||
void MemoryUtils::init() {
|
||||
memHandle = MEMCreateExpHeapEx((void*)MemoryMapping::getVideoMemoryAddress(), MemoryMapping::getVideoMemorySize(), 0);
|
||||
}
|
||||
|
||||
void* MemoryUtils::alloc(uint32_t size, int32_t align){
|
||||
void* MemoryUtils::alloc(uint32_t size, int32_t align) {
|
||||
return MEMAllocFromExpHeapEx(memHandle,size, align);
|
||||
}
|
||||
|
||||
void MemoryUtils::free(void * ptr){
|
||||
MEMFreeToExpHeap(memHandle,ptr);
|
||||
void MemoryUtils::free(void * ptr) {
|
||||
MEMFreeToExpHeap(memHandle,ptr);
|
||||
}
|
||||
|
@ -18,8 +18,12 @@ uint32_t * getFromGX2Buffer(struct buffer_store store, uint32_t size) {
|
||||
}
|
||||
|
||||
void overlay_helper(wups_overlay_options_type_t screen, overlay_callback callback, void * args) {
|
||||
if(callback == NULL) return;
|
||||
if(!OSIsHomeButtonMenuEnabled()) return; // This pauses the game. Make sure to only do it when the home button is allowed.
|
||||
if(callback == NULL) {
|
||||
return;
|
||||
}
|
||||
if(!OSIsHomeButtonMenuEnabled()) {
|
||||
return; // This pauses the game. Make sure to only do it when the home button is allowed.
|
||||
}
|
||||
|
||||
//TODO: Make sure this actually pauses the game (Hook on GX2VSync?) . Currently only tested from VPADRead which also pauses the game.
|
||||
|
||||
|
@ -22,15 +22,14 @@
|
||||
#include <dynamic_libs/gx2_types.h>
|
||||
#include "mem_utils.h"
|
||||
|
||||
void gdImageToUnormR8G8B8A8(gdImagePtr gdImg, u32 *imgBuffer, u32 width, u32 height, u32 pitch){
|
||||
for(u32 y = 0; y < height; ++y)
|
||||
{
|
||||
for(u32 x = 0; x < width; ++x)
|
||||
{
|
||||
u32 pixel = gdImageGetPixel(gdImg, x, y);
|
||||
void gdImageToUnormR8G8B8A8(gdImagePtr gdImg, u32 *imgBuffer, u32 width, u32 height, u32 pitch) {
|
||||
for(u32 y = 0; y < height; ++y) {
|
||||
for(u32 x = 0; x < width; ++x) {
|
||||
u32 pixel = gdImageGetPixel(gdImg, x, y);
|
||||
|
||||
u8 a = 254 - 2*((u8)gdImageAlpha(gdImg, pixel));
|
||||
if(a == 254) a++;
|
||||
u8 a = 254 - 2*((u8)gdImageAlpha(gdImg, pixel));
|
||||
if(a == 254)
|
||||
a++;
|
||||
|
||||
u8 r = gdImageRed(gdImg, pixel);
|
||||
u8 g = gdImageGreen(gdImg, pixel);
|
||||
@ -111,8 +110,8 @@ void TextureUtils::copyToTexture(GX2ColorBuffer* sourceBuffer, GX2Texture * targ
|
||||
}
|
||||
}
|
||||
|
||||
bool TextureUtils::convertImageToTexture(const uint8_t *img, int32_t imgSize, void * _texture){
|
||||
if(!img || (imgSize < 8) || _texture == NULL){
|
||||
bool TextureUtils::convertImageToTexture(const uint8_t *img, int32_t imgSize, void * _texture) {
|
||||
if(!img || (imgSize < 8) || _texture == NULL) {
|
||||
return false;
|
||||
}
|
||||
GX2Texture * texture = (GX2Texture *) _texture;
|
||||
@ -137,7 +136,7 @@ bool TextureUtils::convertImageToTexture(const uint8_t *img, int32_t imgSize, vo
|
||||
//gdImg = gdImageCreateFromTgaPtr(imgSize, (uint8_t*) img);
|
||||
}
|
||||
|
||||
if(gdImg == 0){
|
||||
if(gdImg == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ DECL(void, __PPCExit, void) {
|
||||
|
||||
DECL_FUNCTION(uint32_t, __OSPhysicalToEffectiveCached, uint32_t phyiscalAddress) {
|
||||
uint32_t result = real___OSPhysicalToEffectiveCached(phyiscalAddress);
|
||||
if(result == 0){
|
||||
if(result == 0) {
|
||||
result = MemoryMapping::PhysicalToEffective(phyiscalAddress);
|
||||
//DEBUG_FUNCTION_LINE("__OSPhysicalToEffectiveCached in %08X out %08X\n",phyiscalAddress,result);
|
||||
}
|
||||
@ -34,7 +34,7 @@ DECL_FUNCTION(uint32_t, __OSPhysicalToEffectiveCached, uint32_t phyiscalAddress)
|
||||
|
||||
DECL_FUNCTION(uint32_t, __OSPhysicalToEffectiveUncached, uint32_t phyiscalAddress) {
|
||||
uint32_t result = real___OSPhysicalToEffectiveUncached(phyiscalAddress);
|
||||
if(result == 0){
|
||||
if(result == 0) {
|
||||
result = MemoryMapping::PhysicalToEffective(phyiscalAddress);
|
||||
//DEBUG_FUNCTION_LINE("__OSPhysicalToEffectiveUncached in %08X out %08X\n",phyiscalAddress,result);
|
||||
return result;
|
||||
@ -45,7 +45,7 @@ DECL_FUNCTION(uint32_t, __OSPhysicalToEffectiveUncached, uint32_t phyiscalAddres
|
||||
|
||||
DECL_FUNCTION(uint32_t, OSEffectiveToPhysical, uint32_t virtualAddress) {
|
||||
uint32_t result = real_OSEffectiveToPhysical(virtualAddress);
|
||||
if(result == 0){
|
||||
if(result == 0) {
|
||||
result = MemoryMapping::EffectiveToPhysical(virtualAddress);
|
||||
//DEBUG_FUNCTION_LINE("OSEffectiveToPhysical in %08X out %08X\n",virtualAddress,result);
|
||||
return result;
|
||||
@ -53,9 +53,9 @@ DECL_FUNCTION(uint32_t, OSEffectiveToPhysical, uint32_t virtualAddress) {
|
||||
return result;
|
||||
}
|
||||
|
||||
DECL_FUNCTION(int32_t, OSIsAddressValid, uint32_t virtualAddress){
|
||||
DECL_FUNCTION(int32_t, OSIsAddressValid, uint32_t virtualAddress) {
|
||||
int32_t result = real_OSIsAddressValid(virtualAddress);
|
||||
if(result == 0){
|
||||
if(result == 0) {
|
||||
result = (MemoryMapping::EffectiveToPhysical(virtualAddress) > 0);
|
||||
//DEBUG_FUNCTION_LINE("OSIsAddressValid in %08X out %d\n",virtualAddress,result);
|
||||
return result;
|
||||
|
@ -81,14 +81,14 @@ public:
|
||||
protected:
|
||||
private:
|
||||
|
||||
DynamicLinkingHelper() {
|
||||
}
|
||||
DynamicLinkingHelper() {
|
||||
}
|
||||
|
||||
~DynamicLinkingHelper() {
|
||||
~DynamicLinkingHelper() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
static DynamicLinkingHelper *instance;
|
||||
};
|
||||
static DynamicLinkingHelper *instance;
|
||||
};
|
||||
|
||||
#endif // DYNAMICLINKINGHELPER_H
|
||||
|
@ -272,7 +272,7 @@ bool ElfTools::elfLink(Elf *elf, size_t shndx, void *destination, Elf32_Sym *sym
|
||||
uint32_t size = symtab[symbol].st_size;
|
||||
|
||||
uint32_t address = pluginData->getMemoryForCommonBySymbol(symbol, align, size);
|
||||
if(address == 0){
|
||||
if(address == 0) {
|
||||
DEBUG_FUNCTION_LINE("Failed to get memory for common relocation\n");
|
||||
return false;
|
||||
}
|
||||
@ -494,7 +494,8 @@ bool ElfTools::elfLinkOne(char type, size_t offset, int32_t addend, void *destin
|
||||
|
||||
result = true;
|
||||
exit_error:
|
||||
if (!result) DEBUG_FUNCTION_LINE("Plugin_ElfLinkOne: exit_error\n");
|
||||
if (!result)
|
||||
DEBUG_FUNCTION_LINE("Plugin_ElfLinkOne: exit_error\n");
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,7 @@ std::vector<PluginInformation *> PluginLoader::getPluginInformation(const char *
|
||||
}
|
||||
}
|
||||
}
|
||||
if(dfd != NULL){
|
||||
if(dfd != NULL) {
|
||||
closedir(dfd);
|
||||
}
|
||||
|
||||
@ -467,7 +467,7 @@ void PluginLoader::copyPluginDataIntoGlobalStruct(std::vector<PluginData *> plug
|
||||
|
||||
replacement_data_plugin_t * plugin_data = &gbl_replacement_data.plugin_data[plugin_index];
|
||||
|
||||
#warning TODO: add GUI option to let the user choose
|
||||
#warning TODO: add GUI option to let the user choose
|
||||
plugin_data->kernel_allowed = true;
|
||||
plugin_data->kernel_init_done = false;
|
||||
|
||||
|
@ -54,25 +54,26 @@ extern const uint32_t switchIconOn_png_size;
|
||||
extern const uint8_t TwitterIcon_png[];
|
||||
extern const uint32_t TwitterIcon_png_size;
|
||||
|
||||
static ResourceFile ResourceList[] =
|
||||
{
|
||||
{"font.ttf", font_ttf, font_ttf_size, NULL, 0},
|
||||
{"gameSettingsButton.png", gameSettingsButton_png, gameSettingsButton_png_size, NULL, 0},
|
||||
{"gameSettingsButtonEx.png", gameSettingsButtonEx_png, gameSettingsButtonEx_png_size, NULL, 0},
|
||||
{"gameSettingsButtonExHighlighted.png", gameSettingsButtonExHighlighted_png, gameSettingsButtonExHighlighted_png_size, NULL, 0},
|
||||
{"gameSettingsButtonExSelected.png", gameSettingsButtonExSelected_png, gameSettingsButtonExSelected_png_size, NULL, 0},
|
||||
{"gameSettingsButtonSelected.png", gameSettingsButtonSelected_png, gameSettingsButtonSelected_png_size, NULL, 0},
|
||||
{"GithubIcon.png", GithubIcon_png, GithubIcon_png_size, NULL, 0},
|
||||
{"HomeButtonIcon.png", HomeButtonIcon_png, HomeButtonIcon_png_size, NULL, 0},
|
||||
{"PlusButtonIcon.png", PlusButtonIcon_png, PlusButtonIcon_png_size, NULL, 0},
|
||||
{"settings_click_2.mp3", settings_click_2_mp3, settings_click_2_mp3_size, NULL, 0},
|
||||
{"switchIconBase.png", switchIconBase_png, switchIconBase_png_size, NULL, 0},
|
||||
{"switchIconBaseHighlighted.png", switchIconBaseHighlighted_png, switchIconBaseHighlighted_png_size, NULL, 0},
|
||||
{"switchIconOff.png", switchIconOff_png, switchIconOff_png_size, NULL, 0},
|
||||
{"switchIconOn.png", switchIconOn_png, switchIconOn_png_size, NULL, 0},
|
||||
{"TwitterIcon.png", TwitterIcon_png, TwitterIcon_png_size, NULL, 0},
|
||||
{NULL, NULL, 0, NULL, 0}
|
||||
static ResourceFile ResourceList[] = {
|
||||
{"font.ttf", font_ttf, font_ttf_size, NULL, 0},
|
||||
{"gameSettingsButton.png", gameSettingsButton_png, gameSettingsButton_png_size, NULL, 0},
|
||||
{"gameSettingsButtonEx.png", gameSettingsButtonEx_png, gameSettingsButtonEx_png_size, NULL, 0},
|
||||
{"gameSettingsButtonExHighlighted.png", gameSettingsButtonExHighlighted_png, gameSettingsButtonExHighlighted_png_size, NULL, 0},
|
||||
{"gameSettingsButtonExSelected.png", gameSettingsButtonExSelected_png, gameSettingsButtonExSelected_png_size, NULL, 0},
|
||||
{"gameSettingsButtonSelected.png", gameSettingsButtonSelected_png, gameSettingsButtonSelected_png_size, NULL, 0},
|
||||
{"GithubIcon.png", GithubIcon_png, GithubIcon_png_size, NULL, 0},
|
||||
{"HomeButtonIcon.png", HomeButtonIcon_png, HomeButtonIcon_png_size, NULL, 0},
|
||||
{"PlusButtonIcon.png", PlusButtonIcon_png, PlusButtonIcon_png_size, NULL, 0},
|
||||
{"settings_click_2.mp3", settings_click_2_mp3, settings_click_2_mp3_size, NULL, 0},
|
||||
{"switchIconBase.png", switchIconBase_png, switchIconBase_png_size, NULL, 0},
|
||||
{"switchIconBaseHighlighted.png", switchIconBaseHighlighted_png, switchIconBaseHighlighted_png_size, NULL, 0},
|
||||
{"switchIconOff.png", switchIconOff_png, switchIconOff_png_size, NULL, 0},
|
||||
{"switchIconOn.png", switchIconOn_png, switchIconOn_png_size, NULL, 0},
|
||||
{"TwitterIcon.png", TwitterIcon_png, TwitterIcon_png_size, NULL, 0},
|
||||
{NULL, NULL, 0, NULL, 0}
|
||||
};
|
||||
|
||||
ResourceFile * getResourceList(){ return ResourceList; }
|
||||
ResourceFile * getResourceList() {
|
||||
return ResourceList;
|
||||
}
|
||||
|
||||
|
@ -202,7 +202,7 @@ public:
|
||||
|
||||
int32_t getIdByName(std::string configID);
|
||||
|
||||
bool hasChanged(){
|
||||
bool hasChanged() {
|
||||
return bChanged;
|
||||
}
|
||||
|
||||
|
@ -25,9 +25,9 @@ void CallHook(wups_loader_hook_type_t hook_type) {
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
// Part of libutils
|
||||
extern uint32_t kern_read(const void *addr);
|
||||
extern void kern_write(void *addr, uint32_t value);
|
||||
// Part of libutils
|
||||
extern uint32_t kern_read(const void *addr);
|
||||
extern void kern_write(void *addr, uint32_t value);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@ -54,7 +54,7 @@ void CallHookEx(wups_loader_hook_type_t hook_type, int32_t plugin_index_needed)
|
||||
continue;
|
||||
}
|
||||
|
||||
#warning TODO: change the order of the wups_loader_hook_type_t enum before an offical release.
|
||||
#warning TODO: change the order of the wups_loader_hook_type_t enum before an offical release.
|
||||
//DEBUG_FUNCTION_LINE("Checking hook functions for %s.\n",plugin_data->plugin_name);
|
||||
//DEBUG_FUNCTION_LINE("Found hooks: %d\n",plugin_data->number_used_hooks);
|
||||
for(int32_t j=0; j<plugin_data->number_used_hooks; j++) {
|
||||
@ -99,7 +99,7 @@ void CallHookEx(wups_loader_hook_type_t hook_type, int32_t plugin_index_needed)
|
||||
if(gSDInitDone & WUPS_USB_MOUNTED) {
|
||||
args.usb_mounted = true;
|
||||
}
|
||||
if(plugin_data->kernel_allowed && plugin_data->kernel_init_done){
|
||||
if(plugin_data->kernel_allowed && plugin_data->kernel_init_done) {
|
||||
args.kernel_access = true;
|
||||
}
|
||||
((void (*)(wups_loader_app_started_args_t))((uint32_t*)func_ptr) )(args);
|
||||
@ -121,9 +121,9 @@ void CallHookEx(wups_loader_hook_type_t hook_type, int32_t plugin_index_needed)
|
||||
status = WUPS_APP_STATUS_UNKNOWN;
|
||||
}
|
||||
((void (*)(wups_loader_app_status_t))((uint32_t*)func_ptr))(status);
|
||||
} else if(hook_type == WUPS_LOADER_HOOK_INIT_KERNEL){
|
||||
} else if(hook_type == WUPS_LOADER_HOOK_INIT_KERNEL) {
|
||||
// Only call the hook if kernel is allowed.
|
||||
if(plugin_data->kernel_allowed){
|
||||
if(plugin_data->kernel_allowed) {
|
||||
wups_loader_init_kernel_args_t args;
|
||||
args.kern_read_ptr = &kern_read;
|
||||
args.kern_write_ptr = &kern_write;
|
||||
|
Loading…
Reference in New Issue
Block a user