mirror of
https://github.com/wiiu-env/WiiUPluginLoaderGUI.git
synced 2024-11-29 04:24:16 +01:00
Formatting
This commit is contained in:
parent
9442c5d62a
commit
16fb3a7080
@ -187,7 +187,7 @@ void Application::executeThread(void) {
|
|||||||
bool result = linkPluginsCallback();
|
bool result = linkPluginsCallback();
|
||||||
if(!result) {
|
if(!result) {
|
||||||
// On linking errors return to the HBL.
|
// 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;
|
exitCode = APPLICATION_CLOSE_MIIMAKER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,8 +28,7 @@ DefaultGuiSelectBox::DefaultGuiSelectBox(std::string caption, GuiFrame *parent)
|
|||||||
,valueImageData(Resources::GetImageData("gameSettingsButtonEx.png"))
|
,valueImageData(Resources::GetImageData("gameSettingsButtonEx.png"))
|
||||||
,valueSelectedImageData(Resources::GetImageData("gameSettingsButtonExSelected.png"))
|
,valueSelectedImageData(Resources::GetImageData("gameSettingsButtonExSelected.png"))
|
||||||
,valueHighlightedImageData(Resources::GetImageData("gameSettingsButtonExHighlighted.png"))
|
,valueHighlightedImageData(Resources::GetImageData("gameSettingsButtonExHighlighted.png"))
|
||||||
,buttonClickSound(Resources::GetSound("settings_click_2.mp3"))
|
,buttonClickSound(Resources::GetSound("settings_click_2.mp3")) {
|
||||||
{
|
|
||||||
setSize(topBackgroundImg_img.getWidth(),topBackgroundImg_img.getHeight());
|
setSize(topBackgroundImg_img.getWidth(),topBackgroundImg_img.getHeight());
|
||||||
this->setImageTopBackground(&topBackgroundImg_img);
|
this->setImageTopBackground(&topBackgroundImg_img);
|
||||||
this->setImageTopHighlighted(&topHighlightedImg_img);
|
this->setImageTopHighlighted(&topHighlightedImg_img);
|
||||||
@ -41,8 +40,7 @@ DefaultGuiSelectBox::DefaultGuiSelectBox(std::string caption, GuiFrame *parent)
|
|||||||
/**
|
/**
|
||||||
* Destructor for the DefaultGuiSelectBox class.
|
* Destructor for the DefaultGuiSelectBox class.
|
||||||
*/
|
*/
|
||||||
DefaultGuiSelectBox::~DefaultGuiSelectBox()
|
DefaultGuiSelectBox::~DefaultGuiSelectBox() {
|
||||||
{
|
|
||||||
Resources::RemoveImageData(topBackgroundImg_imgdata);
|
Resources::RemoveImageData(topBackgroundImg_imgdata);
|
||||||
Resources::RemoveImageData(topHighlightedImg_imgdata);
|
Resources::RemoveImageData(topHighlightedImg_imgdata);
|
||||||
Resources::RemoveImageData(valueImageData);
|
Resources::RemoveImageData(valueImageData);
|
||||||
|
@ -20,15 +20,15 @@
|
|||||||
#include <gui/GuiSelectBox.h>
|
#include <gui/GuiSelectBox.h>
|
||||||
|
|
||||||
//!A simple select box with default values.
|
//!A simple select box with default values.
|
||||||
class DefaultGuiSelectBox : public GuiSelectBox{
|
class DefaultGuiSelectBox : public GuiSelectBox {
|
||||||
public:
|
public:
|
||||||
//!Constructor
|
//!Constructor
|
||||||
//!\param checked Checked
|
//!\param checked Checked
|
||||||
DefaultGuiSelectBox(std::string caption, GuiFrame *parent = NULL);
|
DefaultGuiSelectBox(std::string caption, GuiFrame *parent = NULL);
|
||||||
//!Destructor
|
//!Destructor
|
||||||
virtual ~DefaultGuiSelectBox();
|
virtual ~DefaultGuiSelectBox();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
GuiImageData * topBackgroundImg_imgdata;
|
GuiImageData * topBackgroundImg_imgdata;
|
||||||
GuiImage topBackgroundImg_img;
|
GuiImage topBackgroundImg_img;
|
||||||
|
|
||||||
|
@ -28,8 +28,7 @@ DefaultGuiSwitch::DefaultGuiSwitch(bool checked)
|
|||||||
,switchOn_imgdata(Resources::GetImageData("switchIconOn.png"))
|
,switchOn_imgdata(Resources::GetImageData("switchIconOn.png"))
|
||||||
,switchOn_img(switchOn_imgdata)
|
,switchOn_img(switchOn_imgdata)
|
||||||
,switchOff_imgdata(Resources::GetImageData("switchIconOff.png"))
|
,switchOff_imgdata(Resources::GetImageData("switchIconOff.png"))
|
||||||
,switchOff_img(switchOff_imgdata)
|
,switchOff_img(switchOff_imgdata) {
|
||||||
{
|
|
||||||
setSize(switchbase_img.getWidth(),switchbase_img.getHeight());
|
setSize(switchbase_img.getWidth(),switchbase_img.getHeight());
|
||||||
this->setImageBackground(&switchbase_img);
|
this->setImageBackground(&switchbase_img);
|
||||||
this->setImageHighlighted(&switchbase_highlighted_img);
|
this->setImageHighlighted(&switchbase_highlighted_img);
|
||||||
@ -39,8 +38,7 @@ DefaultGuiSwitch::DefaultGuiSwitch(bool checked)
|
|||||||
/**
|
/**
|
||||||
* Destructor for the DefaultGuiSwitch class.
|
* Destructor for the DefaultGuiSwitch class.
|
||||||
*/
|
*/
|
||||||
DefaultGuiSwitch::~DefaultGuiSwitch()
|
DefaultGuiSwitch::~DefaultGuiSwitch() {
|
||||||
{
|
|
||||||
Resources::RemoveImageData(switchbase_imgdata);
|
Resources::RemoveImageData(switchbase_imgdata);
|
||||||
Resources::RemoveImageData(switchbase_highlighted_imgdata);
|
Resources::RemoveImageData(switchbase_highlighted_imgdata);
|
||||||
Resources::RemoveImageData(switchOn_imgdata);
|
Resources::RemoveImageData(switchOn_imgdata);
|
||||||
|
@ -20,15 +20,15 @@
|
|||||||
#include <gui/GuiSwitch.h>
|
#include <gui/GuiSwitch.h>
|
||||||
|
|
||||||
//!A simple switch
|
//!A simple switch
|
||||||
class DefaultGuiSwitch : public GuiSwitch{
|
class DefaultGuiSwitch : public GuiSwitch {
|
||||||
public:
|
public:
|
||||||
//!Constructor
|
//!Constructor
|
||||||
//!\param checked Checked
|
//!\param checked Checked
|
||||||
DefaultGuiSwitch(bool checked);
|
DefaultGuiSwitch(bool checked);
|
||||||
//!Destructor
|
//!Destructor
|
||||||
virtual ~DefaultGuiSwitch();
|
virtual ~DefaultGuiSwitch();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
GuiImageData * switchbase_imgdata = NULL;
|
GuiImageData * switchbase_imgdata = NULL;
|
||||||
GuiImage switchbase_img;
|
GuiImage switchbase_img;
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@ extern "C" int32_t Menu_Main(int32_t argc, char **argv) {
|
|||||||
g_vid_originalContextSave = NULL;
|
g_vid_originalContextSave = NULL;
|
||||||
g_vid_ownContextState = NULL;
|
g_vid_ownContextState = NULL;
|
||||||
g_NotInLoader = false;
|
g_NotInLoader = false;
|
||||||
}else{
|
} else {
|
||||||
g_NotInLoader = true;
|
g_NotInLoader = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -231,7 +231,7 @@ bool ContentHome::linkPlugins() {
|
|||||||
|
|
||||||
void ContentHome::update(GuiController * c) {
|
void ContentHome::update(GuiController * c) {
|
||||||
ContentTemplate::update(c);
|
ContentTemplate::update(c);
|
||||||
if(updateButtons){
|
if(updateButtons) {
|
||||||
for (auto const& x : selectionMapping) {
|
for (auto const& x : selectionMapping) {
|
||||||
int index = x.first;
|
int index = x.first;
|
||||||
GuiToggle* toggle = x.second;
|
GuiToggle* toggle = x.second;
|
||||||
|
@ -8,20 +8,17 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct _sr_table_t
|
typedef struct _sr_table_t {
|
||||||
{
|
|
||||||
uint32_t value[16];
|
uint32_t value[16];
|
||||||
uint32_t sdr1;
|
uint32_t sdr1;
|
||||||
} sr_table_t;
|
} sr_table_t;
|
||||||
|
|
||||||
typedef struct _bat_t
|
typedef struct _bat_t {
|
||||||
{
|
|
||||||
uint32_t h;
|
uint32_t h;
|
||||||
uint32_t l;
|
uint32_t l;
|
||||||
} bat_t;
|
} bat_t;
|
||||||
|
|
||||||
typedef struct _bat_table_t
|
typedef struct _bat_table_t {
|
||||||
{
|
|
||||||
bat_t bat[8];
|
bat_t bat[8];
|
||||||
} bat_table_t;
|
} bat_table_t;
|
||||||
|
|
||||||
|
@ -66,7 +66,8 @@ static void KernelWriteSRs(sr_table_t * table) {
|
|||||||
asm volatile("mtsr 5, %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 6, %0" : : "r" (table->value[6])); i++;
|
||||||
/*asm volatile("mtsr 7, %0" : : "r" (table->value[i])); i++;*/
|
/*asm volatile("mtsr 7, %0" : : "r" (table->value[i])); i++;*/
|
||||||
asm volatile("mtsr 8, %0" : : "r" (table->value[8])); i++;
|
asm volatile("mtsr 8, %0" : : "r" (table->value[8]));
|
||||||
|
i++;
|
||||||
/*asm volatile("mtsr 9, %0" : : "r" (table->value[i])); i++;
|
/*asm volatile("mtsr 9, %0" : : "r" (table->value[i])); i++;
|
||||||
asm volatile("mtsr 10, %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 11, %0" : : "r" (table->value[i])); i++;
|
||||||
@ -87,7 +88,7 @@ void KernelReadPTE(uint32_t* dest, uint32_t size) {
|
|||||||
asm volatile("mfmsr %0" : "=r" (msr));
|
asm volatile("mfmsr %0" : "=r" (msr));
|
||||||
oldmsr = msr;
|
oldmsr = msr;
|
||||||
msr &= ~0x10;
|
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 value_read = 0;
|
||||||
uint32_t addr = addr_base + (i*4);
|
uint32_t addr = addr_base + (i*4);
|
||||||
// Disable Data address translation
|
// Disable Data address translation
|
||||||
@ -107,7 +108,7 @@ void KernelWritePTE(uint32_t * in_addr, uint32_t size) {
|
|||||||
asm volatile("mfmsr %0" : "=r" (msr));
|
asm volatile("mfmsr %0" : "=r" (msr));
|
||||||
oldmsr = msr;
|
oldmsr = msr;
|
||||||
msr &= ~0x10;
|
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 addr = addr_base + (i*4);
|
||||||
uint32_t value = in_addr[i];
|
uint32_t value = in_addr[i];
|
||||||
// Disable Data address translation
|
// 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 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
|
//! assign 1 so that this variable gets into the retained .data section
|
||||||
static uint8_t ucSyscallsSetupRequired = 1;
|
static uint8_t ucSyscallsSetupRequired = 1;
|
||||||
if(!ucSyscallsSetupRequired)
|
if(!ucSyscallsSetupRequired)
|
||||||
|
@ -683,24 +683,24 @@ bool MemoryMapping::mapMemory(uint32_t pa_start_address,uint32_t pa_end_address,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t MemoryMapping::PhysicalToEffective(uint32_t phyiscalAddress){
|
uint32_t MemoryMapping::PhysicalToEffective(uint32_t phyiscalAddress) {
|
||||||
uint32_t result = 0;
|
uint32_t result = 0;
|
||||||
const memory_values_t * curMemValues = NULL;
|
const memory_values_t * curMemValues = NULL;
|
||||||
int32_t curOffset = 0;
|
int32_t curOffset = 0;
|
||||||
//iterate through all own mapped memory regions
|
//iterate through all own mapped memory regions
|
||||||
for(int32_t i = 0;true;i++){
|
for(int32_t i = 0; true; i++) {
|
||||||
if(mem_mapping[i].physical_addresses == NULL){
|
if(mem_mapping[i].physical_addresses == NULL) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
curMemValues = mem_mapping[i].physical_addresses;
|
curMemValues = mem_mapping[i].physical_addresses;
|
||||||
uint32_t curOffsetInEA = 0;
|
uint32_t curOffsetInEA = 0;
|
||||||
// iterate through all memory values of this region
|
// iterate through all memory values of this region
|
||||||
for(int32_t j= 0;true;j++){
|
for(int32_t j= 0; true; j++) {
|
||||||
if(curMemValues[j].end_address == 0){
|
if(curMemValues[j].end_address == 0) {
|
||||||
break;
|
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
|
// calculate the EA
|
||||||
result = (phyiscalAddress - curMemValues[j].start_address) + (mem_mapping[i].effective_start_address + curOffsetInEA);
|
result = (phyiscalAddress - curMemValues[j].start_address) + (mem_mapping[i].effective_start_address + curOffsetInEA);
|
||||||
return result;
|
return result;
|
||||||
@ -712,33 +712,33 @@ uint32_t MemoryMapping::PhysicalToEffective(uint32_t phyiscalAddress){
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t MemoryMapping::EffectiveToPhysical(uint32_t effectiveAddress){
|
uint32_t MemoryMapping::EffectiveToPhysical(uint32_t effectiveAddress) {
|
||||||
uint32_t result = 0;
|
uint32_t result = 0;
|
||||||
// CAUTION: The data may be fragmented between multiple areas in PA.
|
// CAUTION: The data may be fragmented between multiple areas in PA.
|
||||||
const memory_values_t * curMemValues = NULL;
|
const memory_values_t * curMemValues = NULL;
|
||||||
int32_t curOffset = 0;
|
int32_t curOffset = 0;
|
||||||
|
|
||||||
for(int32_t i = 0;true;i++){
|
for(int32_t i = 0; true; i++) {
|
||||||
if(mem_mapping[i].physical_addresses == NULL){
|
if(mem_mapping[i].physical_addresses == NULL) {
|
||||||
break;
|
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;
|
curMemValues = mem_mapping[i].physical_addresses;
|
||||||
curOffset = mem_mapping[i].effective_start_address;
|
curOffset = mem_mapping[i].effective_start_address;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(curMemValues == NULL){
|
if(curMemValues == NULL) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int32_t i= 0;true;i++){
|
for(int32_t i= 0; true; i++) {
|
||||||
if(curMemValues[i].end_address == 0){
|
if(curMemValues[i].end_address == 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
int32_t curChunkSize = curMemValues[i].end_address - curMemValues[i].start_address;
|
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;
|
result = (effectiveAddress - curOffset) + curMemValues[i].start_address;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -53,12 +53,12 @@ typedef struct _memory_mapping_t {
|
|||||||
#define MEMORY_START_PLUGIN_HEAP_END MEMORY_START_PLUGIN_HEAP + MEMORY_PLUGIN_HEAP_SIZE
|
#define MEMORY_START_PLUGIN_HEAP_END MEMORY_START_PLUGIN_HEAP + MEMORY_PLUGIN_HEAP_SIZE
|
||||||
|
|
||||||
const memory_values_t mem_vals_loader[] = {
|
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}
|
{0,0}
|
||||||
};
|
};
|
||||||
|
|
||||||
const memory_values_t mem_vals_plugins[] = {
|
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}
|
{0,0}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -85,7 +85,7 @@ const memory_values_t mem_vals_video[] = {
|
|||||||
// size += 0x20000; // value have to be a multiple of 0x20000;
|
// 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
|
// 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.
|
// a loader heap. Which should be enough for now.
|
||||||
//{0x14000000 + 0x02E00000 , 0x14000000 +0x034E0000}, // size: 7040 kB
|
//{0x14000000 + 0x02E00000 , 0x14000000 +0x034E0000}, // size: 7040 kB
|
||||||
|
@ -104,7 +104,7 @@ bool ConfigInformation::updateConfigSettings() {
|
|||||||
for (auto & curItem : curCat->getItems()) {
|
for (auto & curItem : curCat->getItems()) {
|
||||||
std::string configID = curItem->getConfigID();
|
std::string configID = curItem->getConfigID();
|
||||||
std::string newValue = curItem->persistValue();
|
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.
|
// When the value has changed, call the callback.
|
||||||
DEBUG_FUNCTION_LINE("Called callback. Reason. Menu was closed and value has changed\n");
|
DEBUG_FUNCTION_LINE("Called callback. Reason. Menu was closed and value has changed\n");
|
||||||
curItem->callCallback();
|
curItem->callCallback();
|
||||||
|
@ -229,9 +229,9 @@ void ConfigUtils::configMenuOpenedCallback(wups_overlay_options_type_t screen, v
|
|||||||
if(!ignore && curSelect == inSelect) {
|
if(!ignore && curSelect == inSelect) {
|
||||||
if(curSelect == 0) {
|
if(curSelect == 0) {
|
||||||
curScreenOffset = 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;
|
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;
|
curScreenOffset -= (cur_visible_rows + curScreenOffset) - visible_rows_range/2;
|
||||||
}
|
}
|
||||||
ignore = true;
|
ignore = true;
|
||||||
|
@ -24,14 +24,14 @@
|
|||||||
|
|
||||||
int32_t memHandle __attribute__((section(".data"))) = -1;
|
int32_t memHandle __attribute__((section(".data"))) = -1;
|
||||||
|
|
||||||
void MemoryUtils::init(){
|
void MemoryUtils::init() {
|
||||||
memHandle = MEMCreateExpHeapEx((void*)MemoryMapping::getVideoMemoryAddress(), MemoryMapping::getVideoMemorySize(), 0);
|
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);
|
return MEMAllocFromExpHeapEx(memHandle,size, align);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MemoryUtils::free(void * ptr){
|
void MemoryUtils::free(void * ptr) {
|
||||||
MEMFreeToExpHeap(memHandle,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) {
|
void overlay_helper(wups_overlay_options_type_t screen, overlay_callback callback, void * args) {
|
||||||
if(callback == NULL) return;
|
if(callback == NULL) {
|
||||||
if(!OSIsHomeButtonMenuEnabled()) return; // This pauses the game. Make sure to only do it when the home button is allowed.
|
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.
|
//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 <dynamic_libs/gx2_types.h>
|
||||||
#include "mem_utils.h"
|
#include "mem_utils.h"
|
||||||
|
|
||||||
void gdImageToUnormR8G8B8A8(gdImagePtr gdImg, u32 *imgBuffer, u32 width, u32 height, u32 pitch){
|
void gdImageToUnormR8G8B8A8(gdImagePtr gdImg, u32 *imgBuffer, u32 width, u32 height, u32 pitch) {
|
||||||
for(u32 y = 0; y < height; ++y)
|
for(u32 y = 0; y < height; ++y) {
|
||||||
{
|
for(u32 x = 0; x < width; ++x) {
|
||||||
for(u32 x = 0; x < width; ++x)
|
|
||||||
{
|
|
||||||
u32 pixel = gdImageGetPixel(gdImg, x, y);
|
u32 pixel = gdImageGetPixel(gdImg, x, y);
|
||||||
|
|
||||||
u8 a = 254 - 2*((u8)gdImageAlpha(gdImg, pixel));
|
u8 a = 254 - 2*((u8)gdImageAlpha(gdImg, pixel));
|
||||||
if(a == 254) a++;
|
if(a == 254)
|
||||||
|
a++;
|
||||||
|
|
||||||
u8 r = gdImageRed(gdImg, pixel);
|
u8 r = gdImageRed(gdImg, pixel);
|
||||||
u8 g = gdImageGreen(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){
|
bool TextureUtils::convertImageToTexture(const uint8_t *img, int32_t imgSize, void * _texture) {
|
||||||
if(!img || (imgSize < 8) || _texture == NULL){
|
if(!img || (imgSize < 8) || _texture == NULL) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
GX2Texture * texture = (GX2Texture *) _texture;
|
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);
|
//gdImg = gdImageCreateFromTgaPtr(imgSize, (uint8_t*) img);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(gdImg == 0){
|
if(gdImg == 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ DECL(void, __PPCExit, void) {
|
|||||||
|
|
||||||
DECL_FUNCTION(uint32_t, __OSPhysicalToEffectiveCached, uint32_t phyiscalAddress) {
|
DECL_FUNCTION(uint32_t, __OSPhysicalToEffectiveCached, uint32_t phyiscalAddress) {
|
||||||
uint32_t result = real___OSPhysicalToEffectiveCached(phyiscalAddress);
|
uint32_t result = real___OSPhysicalToEffectiveCached(phyiscalAddress);
|
||||||
if(result == 0){
|
if(result == 0) {
|
||||||
result = MemoryMapping::PhysicalToEffective(phyiscalAddress);
|
result = MemoryMapping::PhysicalToEffective(phyiscalAddress);
|
||||||
//DEBUG_FUNCTION_LINE("__OSPhysicalToEffectiveCached in %08X out %08X\n",phyiscalAddress,result);
|
//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) {
|
DECL_FUNCTION(uint32_t, __OSPhysicalToEffectiveUncached, uint32_t phyiscalAddress) {
|
||||||
uint32_t result = real___OSPhysicalToEffectiveUncached(phyiscalAddress);
|
uint32_t result = real___OSPhysicalToEffectiveUncached(phyiscalAddress);
|
||||||
if(result == 0){
|
if(result == 0) {
|
||||||
result = MemoryMapping::PhysicalToEffective(phyiscalAddress);
|
result = MemoryMapping::PhysicalToEffective(phyiscalAddress);
|
||||||
//DEBUG_FUNCTION_LINE("__OSPhysicalToEffectiveUncached in %08X out %08X\n",phyiscalAddress,result);
|
//DEBUG_FUNCTION_LINE("__OSPhysicalToEffectiveUncached in %08X out %08X\n",phyiscalAddress,result);
|
||||||
return result;
|
return result;
|
||||||
@ -45,7 +45,7 @@ DECL_FUNCTION(uint32_t, __OSPhysicalToEffectiveUncached, uint32_t phyiscalAddres
|
|||||||
|
|
||||||
DECL_FUNCTION(uint32_t, OSEffectiveToPhysical, uint32_t virtualAddress) {
|
DECL_FUNCTION(uint32_t, OSEffectiveToPhysical, uint32_t virtualAddress) {
|
||||||
uint32_t result = real_OSEffectiveToPhysical(virtualAddress);
|
uint32_t result = real_OSEffectiveToPhysical(virtualAddress);
|
||||||
if(result == 0){
|
if(result == 0) {
|
||||||
result = MemoryMapping::EffectiveToPhysical(virtualAddress);
|
result = MemoryMapping::EffectiveToPhysical(virtualAddress);
|
||||||
//DEBUG_FUNCTION_LINE("OSEffectiveToPhysical in %08X out %08X\n",virtualAddress,result);
|
//DEBUG_FUNCTION_LINE("OSEffectiveToPhysical in %08X out %08X\n",virtualAddress,result);
|
||||||
return result;
|
return result;
|
||||||
@ -53,9 +53,9 @@ DECL_FUNCTION(uint32_t, OSEffectiveToPhysical, uint32_t virtualAddress) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
DECL_FUNCTION(int32_t, OSIsAddressValid, uint32_t virtualAddress){
|
DECL_FUNCTION(int32_t, OSIsAddressValid, uint32_t virtualAddress) {
|
||||||
int32_t result = real_OSIsAddressValid(virtualAddress);
|
int32_t result = real_OSIsAddressValid(virtualAddress);
|
||||||
if(result == 0){
|
if(result == 0) {
|
||||||
result = (MemoryMapping::EffectiveToPhysical(virtualAddress) > 0);
|
result = (MemoryMapping::EffectiveToPhysical(virtualAddress) > 0);
|
||||||
//DEBUG_FUNCTION_LINE("OSIsAddressValid in %08X out %d\n",virtualAddress,result);
|
//DEBUG_FUNCTION_LINE("OSIsAddressValid in %08X out %d\n",virtualAddress,result);
|
||||||
return result;
|
return result;
|
||||||
|
@ -89,6 +89,6 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static DynamicLinkingHelper *instance;
|
static DynamicLinkingHelper *instance;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DYNAMICLINKINGHELPER_H
|
#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 size = symtab[symbol].st_size;
|
||||||
|
|
||||||
uint32_t address = pluginData->getMemoryForCommonBySymbol(symbol, align, 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");
|
DEBUG_FUNCTION_LINE("Failed to get memory for common relocation\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -494,7 +494,8 @@ bool ElfTools::elfLinkOne(char type, size_t offset, int32_t addend, void *destin
|
|||||||
|
|
||||||
result = true;
|
result = true;
|
||||||
exit_error:
|
exit_error:
|
||||||
if (!result) DEBUG_FUNCTION_LINE("Plugin_ElfLinkOne: exit_error\n");
|
if (!result)
|
||||||
|
DEBUG_FUNCTION_LINE("Plugin_ElfLinkOne: exit_error\n");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ std::vector<PluginInformation *> PluginLoader::getPluginInformation(const char *
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(dfd != NULL){
|
if(dfd != NULL) {
|
||||||
closedir(dfd);
|
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];
|
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_allowed = true;
|
||||||
plugin_data->kernel_init_done = false;
|
plugin_data->kernel_init_done = false;
|
||||||
|
|
||||||
|
@ -54,8 +54,7 @@ extern const uint32_t switchIconOn_png_size;
|
|||||||
extern const uint8_t TwitterIcon_png[];
|
extern const uint8_t TwitterIcon_png[];
|
||||||
extern const uint32_t TwitterIcon_png_size;
|
extern const uint32_t TwitterIcon_png_size;
|
||||||
|
|
||||||
static ResourceFile ResourceList[] =
|
static ResourceFile ResourceList[] = {
|
||||||
{
|
|
||||||
{"font.ttf", font_ttf, font_ttf_size, NULL, 0},
|
{"font.ttf", font_ttf, font_ttf_size, NULL, 0},
|
||||||
{"gameSettingsButton.png", gameSettingsButton_png, gameSettingsButton_png_size, NULL, 0},
|
{"gameSettingsButton.png", gameSettingsButton_png, gameSettingsButton_png_size, NULL, 0},
|
||||||
{"gameSettingsButtonEx.png", gameSettingsButtonEx_png, gameSettingsButtonEx_png_size, NULL, 0},
|
{"gameSettingsButtonEx.png", gameSettingsButtonEx_png, gameSettingsButtonEx_png_size, NULL, 0},
|
||||||
@ -74,5 +73,7 @@ static ResourceFile ResourceList[] =
|
|||||||
{NULL, NULL, 0, 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);
|
int32_t getIdByName(std::string configID);
|
||||||
|
|
||||||
bool hasChanged(){
|
bool hasChanged() {
|
||||||
return bChanged;
|
return bChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,9 +25,9 @@ void CallHook(wups_loader_hook_type_t hook_type) {
|
|||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
// Part of libutils
|
// Part of libutils
|
||||||
extern uint32_t kern_read(const void *addr);
|
extern uint32_t kern_read(const void *addr);
|
||||||
extern void kern_write(void *addr, uint32_t value);
|
extern void kern_write(void *addr, uint32_t value);
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -54,7 +54,7 @@ void CallHookEx(wups_loader_hook_type_t hook_type, int32_t plugin_index_needed)
|
|||||||
continue;
|
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("Checking hook functions for %s.\n",plugin_data->plugin_name);
|
||||||
//DEBUG_FUNCTION_LINE("Found hooks: %d\n",plugin_data->number_used_hooks);
|
//DEBUG_FUNCTION_LINE("Found hooks: %d\n",plugin_data->number_used_hooks);
|
||||||
for(int32_t j=0; j<plugin_data->number_used_hooks; j++) {
|
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) {
|
if(gSDInitDone & WUPS_USB_MOUNTED) {
|
||||||
args.usb_mounted = true;
|
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;
|
args.kernel_access = true;
|
||||||
}
|
}
|
||||||
((void (*)(wups_loader_app_started_args_t))((uint32_t*)func_ptr) )(args);
|
((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;
|
status = WUPS_APP_STATUS_UNKNOWN;
|
||||||
}
|
}
|
||||||
((void (*)(wups_loader_app_status_t))((uint32_t*)func_ptr))(status);
|
((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.
|
// 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;
|
wups_loader_init_kernel_args_t args;
|
||||||
args.kern_read_ptr = &kern_read;
|
args.kern_read_ptr = &kern_read;
|
||||||
args.kern_write_ptr = &kern_write;
|
args.kern_write_ptr = &kern_write;
|
||||||
|
Loading…
Reference in New Issue
Block a user