mirror of
https://github.com/wiiu-env/WiiUPluginSystem.git
synced 2025-01-12 17:39:07 +01:00
[Loader] Code formatting and minor logging improvements.
This commit is contained in:
parent
409527fb21
commit
55dd57d62f
4
.gitignore
vendored
4
.gitignore
vendored
@ -8,7 +8,11 @@ plugins/*/bin/*
|
|||||||
plugins/*/build/*
|
plugins/*/build/*
|
||||||
loader/WiiUPluginLoader.cscope_file_list
|
loader/WiiUPluginLoader.cscope_file_list
|
||||||
loader/WiiUPluginLoader.layout
|
loader/WiiUPluginLoader.layout
|
||||||
|
loader/screenshots/*
|
||||||
release/*
|
release/*
|
||||||
|
|
||||||
*.mod
|
*.mod
|
||||||
*.cbp
|
*.cbp
|
||||||
|
*.id*
|
||||||
|
*.nam
|
||||||
|
*.til
|
||||||
|
@ -34,8 +34,7 @@ Application::Application()
|
|||||||
, bgMusic(NULL)
|
, bgMusic(NULL)
|
||||||
, video(NULL)
|
, video(NULL)
|
||||||
, mainWindow(NULL)
|
, mainWindow(NULL)
|
||||||
, exitCode(EXIT_RELAUNCH_ON_LOAD)
|
, exitCode(EXIT_RELAUNCH_ON_LOAD) {
|
||||||
{
|
|
||||||
controller[0] = new VPadController(GuiTrigger::CHANNEL_1);
|
controller[0] = new VPadController(GuiTrigger::CHANNEL_1);
|
||||||
controller[1] = new WPadController(GuiTrigger::CHANNEL_2);
|
controller[1] = new WPadController(GuiTrigger::CHANNEL_2);
|
||||||
controller[2] = new WPadController(GuiTrigger::CHANNEL_3);
|
controller[2] = new WPadController(GuiTrigger::CHANNEL_3);
|
||||||
@ -54,18 +53,18 @@ Application::Application()
|
|||||||
}
|
}
|
||||||
|
|
||||||
Application::~Application() {
|
Application::~Application() {
|
||||||
log_printf("Application::~Application(line %d): Destroy music\n",__LINE__);
|
DEBUG_FUNCTION_LINE("Destroy music\n");
|
||||||
delete bgMusic;
|
delete bgMusic;
|
||||||
|
|
||||||
log_printf("Application::~Application(line %d): Destroy controller\n",__LINE__);
|
DEBUG_FUNCTION_LINE("Destroy controller\n");
|
||||||
|
|
||||||
for(s32 i = 0; i < 5; i++)
|
for(s32 i = 0; i < 5; i++)
|
||||||
delete controller[i];
|
delete controller[i];
|
||||||
|
|
||||||
//We may have to handle Asyncdelete in the Destructors.
|
//We may have to handle Asyncdelete in the Destructors.
|
||||||
log_printf("Application::~Application(line %d): Destroy async deleter\n",__LINE__);
|
DEBUG_FUNCTION_LINE("Destroy async deleter\n");
|
||||||
do {
|
do {
|
||||||
log_printf("Application::~Application(line %d): Triggering AsyncDeleter\n",__LINE__);
|
DEBUG_FUNCTION_LINE("Triggering AsyncDeleter\n");
|
||||||
AsyncDeleter::triggerDeleteProcess();
|
AsyncDeleter::triggerDeleteProcess();
|
||||||
while(!AsyncDeleter::realListEmpty()) {
|
while(!AsyncDeleter::realListEmpty()) {
|
||||||
os_usleep(1000);
|
os_usleep(1000);
|
||||||
@ -73,10 +72,10 @@ Application::~Application(){
|
|||||||
} while(!AsyncDeleter::deleteListEmpty());
|
} while(!AsyncDeleter::deleteListEmpty());
|
||||||
AsyncDeleter::destroyInstance();
|
AsyncDeleter::destroyInstance();
|
||||||
|
|
||||||
log_printf("Application::~Application(line %d): Clear resources\n",__LINE__);
|
DEBUG_FUNCTION_LINE("Clear resources\n");
|
||||||
Resources::Clear();
|
Resources::Clear();
|
||||||
|
|
||||||
log_printf("Application::~Application(line %d): Stop sound handler\n",__LINE__);
|
DEBUG_FUNCTION_LINE("Stop sound handler\n");
|
||||||
SoundHandler::DestroyInstance();
|
SoundHandler::DestroyInstance();
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -94,10 +93,11 @@ void Application::reloadUI(){
|
|||||||
reloadUIflag = true;
|
reloadUIflag = true;
|
||||||
}
|
}
|
||||||
void Application::fadeOut() {
|
void Application::fadeOut() {
|
||||||
GuiImage fadeOut(video->getTvWidth(), video->getTvHeight(), (GX2Color){ 0, 0, 0, 255 });
|
GuiImage fadeOut(video->getTvWidth(), video->getTvHeight(), (GX2Color) {
|
||||||
|
0, 0, 0, 255
|
||||||
|
});
|
||||||
|
|
||||||
for(s32 i = 0; i < 255; i += 10)
|
for(s32 i = 0; i < 255; i += 10) {
|
||||||
{
|
|
||||||
if(i > 255)
|
if(i > 255)
|
||||||
i = 255;
|
i = 255;
|
||||||
|
|
||||||
@ -141,13 +141,13 @@ void Application::fadeOut(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Application::executeThread(void) {
|
void Application::executeThread(void) {
|
||||||
log_printf("Application::executeThread(line %d): Initialize video\n",__LINE__);
|
DEBUG_FUNCTION_LINE("Initialize video\n");
|
||||||
video = new CVideo(GX2_TV_SCAN_MODE_720P, GX2_DRC_SINGLE);
|
video = new CVideo(GX2_TV_SCAN_MODE_720P, GX2_DRC_SINGLE);
|
||||||
|
|
||||||
log_printf("Application::executeThread(line %d): Video size %i x %i\n",__LINE__, video->getTvWidth(), video->getTvHeight());
|
DEBUG_FUNCTION_LINE("Video size %i x %i\n", video->getTvWidth(), video->getTvHeight());
|
||||||
|
|
||||||
//! setup default Font
|
//! setup default Font
|
||||||
log_printf("Application::executeThread(line %d): Initialize main font system\n",__LINE__);
|
DEBUG_FUNCTION_LINE("Initialize main font system\n");
|
||||||
FreeTypeGX *fontSystem = new FreeTypeGX(Resources::GetFile("font.ttf"), Resources::GetFileSize("font.ttf"), true);
|
FreeTypeGX *fontSystem = new FreeTypeGX(Resources::GetFile("font.ttf"), Resources::GetFileSize("font.ttf"), true);
|
||||||
GuiText::setPresetFont(fontSystem);
|
GuiText::setPresetFont(fontSystem);
|
||||||
|
|
||||||
@ -161,18 +161,17 @@ void Application::executeThread(void){
|
|||||||
while(reloadUIflag) {
|
while(reloadUIflag) {
|
||||||
reloadUIflag = false;
|
reloadUIflag = false;
|
||||||
exitCode = EXIT_RELAUNCH_ON_LOAD;
|
exitCode = EXIT_RELAUNCH_ON_LOAD;
|
||||||
log_printf("Application::executeThread(line %d): Initialize the language\n",__LINE__);
|
DEBUG_FUNCTION_LINE("Initialize the language\n");
|
||||||
loadLanguageFromConfig();
|
loadLanguageFromConfig();
|
||||||
log_printf("Application::executeThread(line %d): Initialize main window\n",__LINE__);
|
DEBUG_FUNCTION_LINE("Initialize main window\n");
|
||||||
mainWindow = MainWindow::getInstance(video->getTvWidth(), video->getTvHeight());
|
mainWindow = MainWindow::getInstance(video->getTvWidth(), video->getTvHeight());
|
||||||
|
|
||||||
log_printf("Application::executeThread(line %d): Entering main loop\n",__LINE__);
|
DEBUG_FUNCTION_LINE("Entering main loop\n");
|
||||||
exitApplication = false;
|
exitApplication = false;
|
||||||
//! main GX2 loop (60 Hz cycle with max priority on core 1)
|
//! main GX2 loop (60 Hz cycle with max priority on core 1)
|
||||||
while(!exitApplication && !reloadUIflag) {
|
while(!exitApplication && !reloadUIflag) {
|
||||||
//! Read out inputs
|
//! Read out inputs
|
||||||
for(s32 i = 0; i < 5; i++)
|
for(s32 i = 0; i < 5; i++) {
|
||||||
{
|
|
||||||
if(controller[i]->update(video->getTvWidth(), video->getTvHeight()) == false)
|
if(controller[i]->update(video->getTvWidth(), video->getTvHeight()) == false)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -26,8 +26,7 @@
|
|||||||
#define APPLICATION_CLOSE_APPLY 1
|
#define APPLICATION_CLOSE_APPLY 1
|
||||||
#define APPLICATION_CLOSE_MIIMAKER 2
|
#define APPLICATION_CLOSE_MIIMAKER 2
|
||||||
|
|
||||||
class Application : public CThread
|
class Application : public CThread {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
static Application * instance() {
|
static Application * instance() {
|
||||||
if(!applicationInstance)
|
if(!applicationInstance)
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
|
||||||
int __entry_menu(int argc, char **argv)
|
int __entry_menu(int argc, char **argv) {
|
||||||
{
|
|
||||||
//! *******************************************************************
|
//! *******************************************************************
|
||||||
//! * Jump to our application *
|
//! * Jump to our application *
|
||||||
//! *******************************************************************
|
//! *******************************************************************
|
||||||
|
@ -196,8 +196,7 @@ s32 isInMiiMakerHBL(){
|
|||||||
OSGetTitleID() == 0x000500101004A200 || // mii maker eur
|
OSGetTitleID() == 0x000500101004A200 || // mii maker eur
|
||||||
OSGetTitleID() == 0x000500101004A100 || // mii maker usa
|
OSGetTitleID() == 0x000500101004A100 || // mii maker usa
|
||||||
OSGetTitleID() == 0x000500101004A000 ||// mii maker jpn
|
OSGetTitleID() == 0x000500101004A000 ||// mii maker jpn
|
||||||
OSGetTitleID() == 0x0005000013374842))
|
OSGetTitleID() == 0x0005000013374842)) {
|
||||||
{
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -29,8 +29,7 @@ MainWindow * MainWindow::instance = NULL;
|
|||||||
|
|
||||||
MainWindow::MainWindow(s32 w, s32 h)
|
MainWindow::MainWindow(s32 w, s32 h)
|
||||||
: width(w)
|
: width(w)
|
||||||
, height(h)
|
, height(h) {
|
||||||
{
|
|
||||||
for(s32 i = 0; i < 4; i++) {
|
for(s32 i = 0; i < 4; i++) {
|
||||||
std::string filename = StringTools::strfmt("player%i_point.png", i+1);
|
std::string filename = StringTools::strfmt("player%i_point.png", i+1);
|
||||||
pointerImgData[i] = Resources::GetImageData(filename.c_str());
|
pointerImgData[i] = Resources::GetImageData(filename.c_str());
|
||||||
@ -42,100 +41,80 @@ MainWindow::MainWindow(s32 w, s32 h)
|
|||||||
SetupMainView();
|
SetupMainView();
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow()
|
MainWindow::~MainWindow() {
|
||||||
{
|
|
||||||
|
|
||||||
while(!tvElements.empty())
|
while(!tvElements.empty()) {
|
||||||
{
|
|
||||||
delete tvElements[0];
|
delete tvElements[0];
|
||||||
remove(tvElements[0]);
|
remove(tvElements[0]);
|
||||||
}
|
}
|
||||||
while(!drcElements.empty())
|
while(!drcElements.empty()) {
|
||||||
{
|
|
||||||
delete drcElements[0];
|
delete drcElements[0];
|
||||||
remove(drcElements[0]);
|
remove(drcElements[0]);
|
||||||
}
|
}
|
||||||
for(s32 i = 0; i < 4; i++)
|
for(s32 i = 0; i < 4; i++) {
|
||||||
{
|
|
||||||
delete pointerImg[i];
|
delete pointerImg[i];
|
||||||
Resources::RemoveImageData(pointerImgData[i]);
|
Resources::RemoveImageData(pointerImgData[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::updateEffects()
|
void MainWindow::updateEffects() {
|
||||||
{
|
|
||||||
//! dont read behind the initial elements in case one was added
|
//! dont read behind the initial elements in case one was added
|
||||||
u32 tvSize = tvElements.size();
|
u32 tvSize = tvElements.size();
|
||||||
u32 drcSize = drcElements.size();
|
u32 drcSize = drcElements.size();
|
||||||
|
|
||||||
for(u32 i = 0; (i < drcSize) && (i < drcElements.size()); ++i)
|
for(u32 i = 0; (i < drcSize) && (i < drcElements.size()); ++i) {
|
||||||
{
|
|
||||||
drcElements[i]->updateEffects();
|
drcElements[i]->updateEffects();
|
||||||
}
|
}
|
||||||
|
|
||||||
//! only update TV elements that are not updated yet because they are on DRC
|
//! only update TV elements that are not updated yet because they are on DRC
|
||||||
for(u32 i = 0; (i < tvSize) && (i < tvElements.size()); ++i)
|
for(u32 i = 0; (i < tvSize) && (i < tvElements.size()); ++i) {
|
||||||
{
|
|
||||||
u32 n;
|
u32 n;
|
||||||
for(n = 0; (n < drcSize) && (n < drcElements.size()); n++)
|
for(n = 0; (n < drcSize) && (n < drcElements.size()); n++) {
|
||||||
{
|
|
||||||
if(tvElements[i] == drcElements[n])
|
if(tvElements[i] == drcElements[n])
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(n == drcElements.size())
|
if(n == drcElements.size()) {
|
||||||
{
|
|
||||||
tvElements[i]->updateEffects();
|
tvElements[i]->updateEffects();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::process()
|
void MainWindow::process() {
|
||||||
{
|
|
||||||
//! dont read behind the initial elements in case one was added
|
//! dont read behind the initial elements in case one was added
|
||||||
u32 tvSize = tvElements.size();
|
u32 tvSize = tvElements.size();
|
||||||
u32 drcSize = drcElements.size();
|
u32 drcSize = drcElements.size();
|
||||||
|
|
||||||
for(u32 i = 0; (i < drcSize) && (i < drcElements.size()); ++i)
|
for(u32 i = 0; (i < drcSize) && (i < drcElements.size()); ++i) {
|
||||||
{
|
|
||||||
drcElements[i]->process();
|
drcElements[i]->process();
|
||||||
}
|
}
|
||||||
|
|
||||||
//! only update TV elements that are not updated yet because they are on DRC
|
//! only update TV elements that are not updated yet because they are on DRC
|
||||||
for(u32 i = 0; (i < tvSize) && (i < tvElements.size()); ++i)
|
for(u32 i = 0; (i < tvSize) && (i < tvElements.size()); ++i) {
|
||||||
{
|
|
||||||
u32 n;
|
u32 n;
|
||||||
for(n = 0; (n < drcSize) && (n < drcElements.size()); n++)
|
for(n = 0; (n < drcSize) && (n < drcElements.size()); n++) {
|
||||||
{
|
|
||||||
if(tvElements[i] == drcElements[n])
|
if(tvElements[i] == drcElements[n])
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(n == drcElements.size())
|
if(n == drcElements.size()) {
|
||||||
{
|
|
||||||
tvElements[i]->process();
|
tvElements[i]->process();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::update(GuiController *controller)
|
void MainWindow::update(GuiController *controller) {
|
||||||
{
|
|
||||||
//! dont read behind the initial elements in case one was added
|
//! dont read behind the initial elements in case one was added
|
||||||
//u32 tvSize = tvElements.size();
|
//u32 tvSize = tvElements.size();
|
||||||
|
|
||||||
if(controller->chan & GuiTrigger::CHANNEL_1)
|
if(controller->chan & GuiTrigger::CHANNEL_1) {
|
||||||
{
|
|
||||||
u32 drcSize = drcElements.size();
|
u32 drcSize = drcElements.size();
|
||||||
|
|
||||||
for(u32 i = 0; (i < drcSize) && (i < drcElements.size()); ++i)
|
for(u32 i = 0; (i < drcSize) && (i < drcElements.size()); ++i) {
|
||||||
{
|
|
||||||
drcElements[i]->update(controller);
|
drcElements[i]->update(controller);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
u32 tvSize = tvElements.size();
|
u32 tvSize = tvElements.size();
|
||||||
|
|
||||||
for(u32 i = 0; (i < tvSize) && (i < tvElements.size()); ++i)
|
for(u32 i = 0; (i < tvSize) && (i < tvElements.size()); ++i) {
|
||||||
{
|
|
||||||
tvElements[i]->update(controller);
|
tvElements[i]->update(controller);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -155,8 +134,7 @@ void MainWindow::update(GuiController *controller)
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
if(controller->chanIdx >= 1 && controller->chanIdx <= 4 && controller->data.validPointer)
|
if(controller->chanIdx >= 1 && controller->chanIdx <= 4 && controller->data.validPointer) {
|
||||||
{
|
|
||||||
s32 wpadIdx = controller->chanIdx - 1;
|
s32 wpadIdx = controller->chanIdx - 1;
|
||||||
f32 posX = controller->data.x;
|
f32 posX = controller->data.x;
|
||||||
f32 posY = controller->data.y;
|
f32 posY = controller->data.y;
|
||||||
@ -166,17 +144,13 @@ void MainWindow::update(GuiController *controller)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::drawDrc(CVideo *video)
|
void MainWindow::drawDrc(CVideo *video) {
|
||||||
{
|
for(u32 i = 0; i < drcElements.size(); ++i) {
|
||||||
for(u32 i = 0; i < drcElements.size(); ++i)
|
|
||||||
{
|
|
||||||
drcElements[i]->draw(video);
|
drcElements[i]->draw(video);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(s32 i = 0; i < 4; i++)
|
for(s32 i = 0; i < 4; i++) {
|
||||||
{
|
if(pointerValid[i]) {
|
||||||
if(pointerValid[i])
|
|
||||||
{
|
|
||||||
pointerImg[i]->setAlpha(0.5f);
|
pointerImg[i]->setAlpha(0.5f);
|
||||||
pointerImg[i]->draw(video);
|
pointerImg[i]->draw(video);
|
||||||
pointerImg[i]->setAlpha(1.0f);
|
pointerImg[i]->setAlpha(1.0f);
|
||||||
@ -184,17 +158,13 @@ void MainWindow::drawDrc(CVideo *video)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::drawTv(CVideo *video)
|
void MainWindow::drawTv(CVideo *video) {
|
||||||
{
|
for(u32 i = 0; i < tvElements.size(); ++i) {
|
||||||
for(u32 i = 0; i < tvElements.size(); ++i)
|
|
||||||
{
|
|
||||||
tvElements[i]->draw(video);
|
tvElements[i]->draw(video);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(s32 i = 0; i < 4; i++)
|
for(s32 i = 0; i < 4; i++) {
|
||||||
{
|
if(pointerValid[i]) {
|
||||||
if(pointerValid[i])
|
|
||||||
{
|
|
||||||
pointerImg[i]->draw(video);
|
pointerImg[i]->draw(video);
|
||||||
pointerValid[i] = false;
|
pointerValid[i] = false;
|
||||||
}
|
}
|
||||||
@ -208,8 +178,7 @@ void MainWindow::SetupMainView(){
|
|||||||
appendDrc(DrcFrame);
|
appendDrc(DrcFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::OnOpenEffectFinish(GuiElement *element)
|
void MainWindow::OnOpenEffectFinish(GuiElement *element) {
|
||||||
{
|
|
||||||
//! once the menu is open reset its state and allow it to be "clicked/hold"
|
//! once the menu is open reset its state and allow it to be "clicked/hold"
|
||||||
element->effectFinished.disconnect(this);
|
element->effectFinished.disconnect(this);
|
||||||
element->clearState(GuiElement::STATE_DISABLED);
|
element->clearState(GuiElement::STATE_DISABLED);
|
||||||
@ -217,8 +186,7 @@ void MainWindow::OnOpenEffectFinish(GuiElement *element)
|
|||||||
|
|
||||||
void MainWindow::appendToAllElements(GuiElement * element) {
|
void MainWindow::appendToAllElements(GuiElement * element) {
|
||||||
u32 drcSize = drcElements.size();
|
u32 drcSize = drcElements.size();
|
||||||
for(u32 i = 0; (i < drcSize) && (i < drcElements.size()); ++i)
|
for(u32 i = 0; (i < drcSize) && (i < drcElements.size()); ++i) {
|
||||||
{
|
|
||||||
GuiFrame * realElement = dynamic_cast<GuiFrame*>(drcElements[i]);
|
GuiFrame * realElement = dynamic_cast<GuiFrame*>(drcElements[i]);
|
||||||
if(realElement != NULL) {
|
if(realElement != NULL) {
|
||||||
realElement->append(element);
|
realElement->append(element);
|
||||||
@ -226,8 +194,7 @@ void MainWindow::appendToAllElements(GuiElement * element){
|
|||||||
}
|
}
|
||||||
|
|
||||||
u32 tvSize = tvElements.size();
|
u32 tvSize = tvElements.size();
|
||||||
for(u32 i = 0; (i < tvSize) && (i < tvElements.size()); ++i)
|
for(u32 i = 0; (i < tvSize) && (i < tvElements.size()); ++i) {
|
||||||
{
|
|
||||||
GuiFrame * realElement = dynamic_cast<GuiFrame*>(tvElements[i]);
|
GuiFrame * realElement = dynamic_cast<GuiFrame*>(tvElements[i]);
|
||||||
if(realElement != NULL) {
|
if(realElement != NULL) {
|
||||||
realElement->append(element);
|
realElement->append(element);
|
||||||
@ -237,8 +204,7 @@ void MainWindow::appendToAllElements(GuiElement * element){
|
|||||||
|
|
||||||
void MainWindow::removeFromAllElements(GuiElement * element) {
|
void MainWindow::removeFromAllElements(GuiElement * element) {
|
||||||
u32 drcSize = drcElements.size();
|
u32 drcSize = drcElements.size();
|
||||||
for(u32 i = 0; (i < drcSize) && (i < drcElements.size()); ++i)
|
for(u32 i = 0; (i < drcSize) && (i < drcElements.size()); ++i) {
|
||||||
{
|
|
||||||
GuiFrame * realElement = dynamic_cast<GuiFrame*>(drcElements[i]);
|
GuiFrame * realElement = dynamic_cast<GuiFrame*>(drcElements[i]);
|
||||||
if(realElement != NULL) {
|
if(realElement != NULL) {
|
||||||
realElement->remove(element);
|
realElement->remove(element);
|
||||||
@ -246,8 +212,7 @@ void MainWindow::removeFromAllElements(GuiElement * element){
|
|||||||
}
|
}
|
||||||
|
|
||||||
u32 tvSize = tvElements.size();
|
u32 tvSize = tvElements.size();
|
||||||
for(u32 i = 0; (i < tvSize) && (i < tvElements.size()); ++i)
|
for(u32 i = 0; (i < tvSize) && (i < tvElements.size()); ++i) {
|
||||||
{
|
|
||||||
GuiFrame * realElement = dynamic_cast<GuiFrame*>(tvElements[i]);
|
GuiFrame * realElement = dynamic_cast<GuiFrame*>(tvElements[i]);
|
||||||
if(realElement != NULL) {
|
if(realElement != NULL) {
|
||||||
realElement->remove(element);
|
realElement->remove(element);
|
||||||
@ -258,28 +223,24 @@ void MainWindow::removeFromAllElements(GuiElement * element){
|
|||||||
|
|
||||||
void MainWindow::setState(s32 val, s32 c) {
|
void MainWindow::setState(s32 val, s32 c) {
|
||||||
u32 drcSize = drcElements.size();
|
u32 drcSize = drcElements.size();
|
||||||
for(u32 i = 0; (i < drcSize) && (i < drcElements.size()); ++i)
|
for(u32 i = 0; (i < drcSize) && (i < drcElements.size()); ++i) {
|
||||||
{
|
|
||||||
drcElements[i]->setState(val,c);
|
drcElements[i]->setState(val,c);
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 tvSize = tvElements.size();
|
u32 tvSize = tvElements.size();
|
||||||
for(u32 i = 0; (i < tvSize) && (i < tvElements.size()); ++i)
|
for(u32 i = 0; (i < tvSize) && (i < tvElements.size()); ++i) {
|
||||||
{
|
|
||||||
tvElements[i]->setState(val,c);
|
tvElements[i]->setState(val,c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::clearState(s32 val, s32 c) {
|
void MainWindow::clearState(s32 val, s32 c) {
|
||||||
u32 drcSize = drcElements.size();
|
u32 drcSize = drcElements.size();
|
||||||
for(u32 i = 0; (i < drcSize) && (i < drcElements.size()); ++i)
|
for(u32 i = 0; (i < drcSize) && (i < drcElements.size()); ++i) {
|
||||||
{
|
|
||||||
drcElements[i]->clearState(val,c);
|
drcElements[i]->clearState(val,c);
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 tvSize = tvElements.size();
|
u32 tvSize = tvElements.size();
|
||||||
for(u32 i = 0; (i < tvSize) && (i < tvElements.size()); ++i)
|
for(u32 i = 0; (i < tvSize) && (i < tvElements.size()); ++i) {
|
||||||
{
|
|
||||||
tvElements[i]->clearState(val,c);
|
tvElements[i]->clearState(val,c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,8 +24,7 @@
|
|||||||
|
|
||||||
class CVideo;
|
class CVideo;
|
||||||
|
|
||||||
class MainWindow : public sigslot::has_slots<>
|
class MainWindow : public sigslot::has_slots<> {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
virtual ~MainWindow();
|
virtual ~MainWindow();
|
||||||
|
|
||||||
@ -49,16 +48,14 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void appendTv(GuiElement *e)
|
void appendTv(GuiElement *e) {
|
||||||
{
|
|
||||||
if(!e)
|
if(!e)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
removeTv(e);
|
removeTv(e);
|
||||||
tvElements.push_back(e);
|
tvElements.push_back(e);
|
||||||
}
|
}
|
||||||
void appendDrc(GuiElement *e)
|
void appendDrc(GuiElement *e) {
|
||||||
{
|
|
||||||
if(!e)
|
if(!e)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -66,22 +63,19 @@ public:
|
|||||||
drcElements.push_back(e);
|
drcElements.push_back(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
void append(GuiElement *e)
|
void append(GuiElement *e) {
|
||||||
{
|
|
||||||
appendTv(e);
|
appendTv(e);
|
||||||
appendDrc(e);
|
appendDrc(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
void insertTv(u32 pos, GuiElement *e)
|
void insertTv(u32 pos, GuiElement *e) {
|
||||||
{
|
|
||||||
if(!e)
|
if(!e)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
removeTv(e);
|
removeTv(e);
|
||||||
tvElements.insert(tvElements.begin() + pos, e);
|
tvElements.insert(tvElements.begin() + pos, e);
|
||||||
}
|
}
|
||||||
void insertDrc(u32 pos, GuiElement *e)
|
void insertDrc(u32 pos, GuiElement *e) {
|
||||||
{
|
|
||||||
if(!e)
|
if(!e)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -89,42 +83,33 @@ public:
|
|||||||
drcElements.insert(drcElements.begin() + pos, e);
|
drcElements.insert(drcElements.begin() + pos, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
void insert(u32 pos, GuiElement *e)
|
void insert(u32 pos, GuiElement *e) {
|
||||||
{
|
|
||||||
insertTv(pos, e);
|
insertTv(pos, e);
|
||||||
insertDrc(pos, e);
|
insertDrc(pos, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
void removeTv(GuiElement *e)
|
void removeTv(GuiElement *e) {
|
||||||
{
|
for(u32 i = 0; i < tvElements.size(); ++i) {
|
||||||
for(u32 i = 0; i < tvElements.size(); ++i)
|
if(e == tvElements[i]) {
|
||||||
{
|
|
||||||
if(e == tvElements[i])
|
|
||||||
{
|
|
||||||
tvElements.erase(tvElements.begin() + i);
|
tvElements.erase(tvElements.begin() + i);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void removeDrc(GuiElement *e)
|
void removeDrc(GuiElement *e) {
|
||||||
{
|
for(u32 i = 0; i < drcElements.size(); ++i) {
|
||||||
for(u32 i = 0; i < drcElements.size(); ++i)
|
if(e == drcElements[i]) {
|
||||||
{
|
|
||||||
if(e == drcElements[i])
|
|
||||||
{
|
|
||||||
drcElements.erase(drcElements.begin() + i);
|
drcElements.erase(drcElements.begin() + i);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void remove(GuiElement *e)
|
void remove(GuiElement *e) {
|
||||||
{
|
|
||||||
removeTv(e);
|
removeTv(e);
|
||||||
removeDrc(e);
|
removeDrc(e);
|
||||||
}
|
}
|
||||||
void removeAll()
|
void removeAll() {
|
||||||
{
|
|
||||||
tvElements.clear();
|
tvElements.clear();
|
||||||
drcElements.clear();
|
drcElements.clear();
|
||||||
}
|
}
|
||||||
|
@ -20,12 +20,21 @@ MainWindowContent::MainWindowContent(s32 w, s32 h)
|
|||||||
: GuiFrame(w, h)
|
: GuiFrame(w, h)
|
||||||
, width(w)
|
, width(w)
|
||||||
, height(h)
|
, height(h)
|
||||||
, bgImageColor(w, h, (GX2Color){ 0, 0, 0, 0 })
|
, bgImageColor(w, h, (GX2Color) {
|
||||||
{
|
0, 0, 0, 0
|
||||||
bgImageColor.setImageColor((GX2Color){ 248, 249, 248, 255 }, 0);
|
}) {
|
||||||
bgImageColor.setImageColor((GX2Color){ 248, 249, 248, 255 }, 1);
|
bgImageColor.setImageColor((GX2Color) {
|
||||||
bgImageColor.setImageColor((GX2Color){ 248, 249, 248, 255 }, 2);
|
248, 249, 248, 255
|
||||||
bgImageColor.setImageColor((GX2Color){ 248, 249, 248, 255 }, 3);
|
}, 0);
|
||||||
|
bgImageColor.setImageColor((GX2Color) {
|
||||||
|
248, 249, 248, 255
|
||||||
|
}, 1);
|
||||||
|
bgImageColor.setImageColor((GX2Color) {
|
||||||
|
248, 249, 248, 255
|
||||||
|
}, 2);
|
||||||
|
bgImageColor.setImageColor((GX2Color) {
|
||||||
|
248, 249, 248, 255
|
||||||
|
}, 3);
|
||||||
|
|
||||||
append(&bgImageColor);
|
append(&bgImageColor);
|
||||||
}
|
}
|
||||||
|
@ -41,8 +41,12 @@ public:
|
|||||||
//If you call this function, please also delete the object. This class isn't taking care of it
|
//If you call this function, please also delete the object. This class isn't taking care of it
|
||||||
static ContentTemplate * createNewContent(eContentNames contentName) {
|
static ContentTemplate * createNewContent(eContentNames contentName) {
|
||||||
switch(contentName) {
|
switch(contentName) {
|
||||||
case CONTENT_HOME: { return new ContentHome(); break;}
|
case CONTENT_HOME: {
|
||||||
default: return NULL;
|
return new ContentHome();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,8 +29,7 @@ ContentHome::ContentHome():ContentTemplate()
|
|||||||
, exitHome(gettext("Exit to HBL "))
|
, exitHome(gettext("Exit to HBL "))
|
||||||
, plusbutton_imgdata(Resources::GetImageData("PlusButtonIcon.png"))
|
, plusbutton_imgdata(Resources::GetImageData("PlusButtonIcon.png"))
|
||||||
, plusbutton_img(plusbutton_imgdata)
|
, plusbutton_img(plusbutton_imgdata)
|
||||||
, exitPlus(gettext("Apply Patches"))
|
, exitPlus(gettext("Apply Patches")) {
|
||||||
{
|
|
||||||
glm::vec4 textColor = glm::vec4(1.0f,1.0f,1.0f,1.0f);
|
glm::vec4 textColor = glm::vec4(1.0f,1.0f,1.0f,1.0f);
|
||||||
|
|
||||||
homebutton_img.setAlignment(ALIGN_LEFT);
|
homebutton_img.setAlignment(ALIGN_LEFT);
|
||||||
|
@ -24,12 +24,21 @@ class ContentTemplate : public GuiFrame, public sigslot::has_slots<>{
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
ContentTemplate() : GuiFrame(SCREEN_WIDTH, SCREEN_HEIGHT)
|
ContentTemplate() : GuiFrame(SCREEN_WIDTH, SCREEN_HEIGHT)
|
||||||
, bgImageColor(SCREEN_WIDTH, SCREEN_HEIGHT, (GX2Color){ 0, 0, 0, 0 })
|
, bgImageColor(SCREEN_WIDTH, SCREEN_HEIGHT, (GX2Color) {
|
||||||
{
|
0, 0, 0, 0
|
||||||
bgImageColor.setImageColor((GX2Color){ 42, 42, 42, 255 }, 0);
|
}) {
|
||||||
bgImageColor.setImageColor((GX2Color){ 42, 42, 42, 255 }, 1);
|
bgImageColor.setImageColor((GX2Color) {
|
||||||
bgImageColor.setImageColor((GX2Color){ 42, 42, 42, 255 }, 2);
|
42, 42, 42, 255
|
||||||
bgImageColor.setImageColor((GX2Color){ 42, 42, 42, 255 }, 3);
|
}, 0);
|
||||||
|
bgImageColor.setImageColor((GX2Color) {
|
||||||
|
42, 42, 42, 255
|
||||||
|
}, 1);
|
||||||
|
bgImageColor.setImageColor((GX2Color) {
|
||||||
|
42, 42, 42, 255
|
||||||
|
}, 2);
|
||||||
|
bgImageColor.setImageColor((GX2Color) {
|
||||||
|
42, 42, 42, 255
|
||||||
|
}, 3);
|
||||||
append(&bgImageColor);
|
append(&bgImageColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,10 +119,10 @@ void new_PatchInvidualMethodHooks(replacement_data_plugin_t * plugin_data){
|
|||||||
DEBUG_FUNCTION_LINE("Patching %s ...\n",function_data->function_name);
|
DEBUG_FUNCTION_LINE("Patching %s ...\n",function_data->function_name);
|
||||||
if(function_data->functionType == STATIC_FUNCTION && function_data->alreadyPatched == 1) {
|
if(function_data->functionType == STATIC_FUNCTION && function_data->alreadyPatched == 1) {
|
||||||
if(new_isDynamicFunction((u32)OSEffectiveToPhysical((void*)function_data->realAddr))) {
|
if(new_isDynamicFunction((u32)OSEffectiveToPhysical((void*)function_data->realAddr))) {
|
||||||
log_printf("The function %s is a dynamic function. Please fix that <3\n", function_data->function_name);
|
DEBUG_FUNCTION_LINE("INFO: The function %s is a dynamic function.\n", function_data->function_name);
|
||||||
function_data->functionType = DYNAMIC_FUNCTION;
|
function_data->functionType = DYNAMIC_FUNCTION;
|
||||||
} else {
|
} else {
|
||||||
log_printf("Skipping %s, its already patched\n", function_data->function_name);
|
DEBUG_FUNCTION_LINE("Skipping %s, its already patched\n", function_data->function_name);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -139,7 +139,9 @@ void new_PatchInvidualMethodHooks(replacement_data_plugin_t * plugin_data){
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(DEBUG_LOG_DYN){DEBUG_FUNCTION_LINE("%s is located at %08X!\n", function_data->function_name,real_addr);}
|
if(DEBUG_LOG_DYN) {
|
||||||
|
DEBUG_FUNCTION_LINE("%s is located at %08X!\n", function_data->function_name,real_addr);
|
||||||
|
}
|
||||||
|
|
||||||
physical = (u32)OSEffectiveToPhysical((void*)real_addr);
|
physical = (u32)OSEffectiveToPhysical((void*)real_addr);
|
||||||
if(!physical) {
|
if(!physical) {
|
||||||
@ -147,7 +149,9 @@ void new_PatchInvidualMethodHooks(replacement_data_plugin_t * plugin_data){
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(DEBUG_LOG_DYN){DEBUG_FUNCTION_LINE("%s physical is located at %08X!\n", function_data->function_name,physical);}
|
if(DEBUG_LOG_DYN) {
|
||||||
|
DEBUG_FUNCTION_LINE("%s physical is located at %08X!\n", function_data->function_name,physical);
|
||||||
|
}
|
||||||
|
|
||||||
*(volatile u32 *)(call_addr) = (u32)(space);
|
*(volatile u32 *)(call_addr) = (u32)(space);
|
||||||
|
|
||||||
@ -160,10 +164,13 @@ void new_PatchInvidualMethodHooks(replacement_data_plugin_t * plugin_data){
|
|||||||
// fill the restore instruction section
|
// fill the restore instruction section
|
||||||
function_data->realAddr = real_addr;
|
function_data->realAddr = real_addr;
|
||||||
function_data->restoreInstruction = *(space-1);
|
function_data->restoreInstruction = *(space-1);
|
||||||
if(DEBUG_LOG_DYN){DEBUG_FUNCTION_LINE("function_data->realAddr = %08X!\n", function_data->realAddr);}
|
if(DEBUG_LOG_DYN) {
|
||||||
if(DEBUG_LOG_DYN){DEBUG_FUNCTION_LINE("function_data->restoreInstruction = %08X!\n",function_data->restoreInstruction) ;}
|
DEBUG_FUNCTION_LINE("function_data->realAddr = %08X!\n", function_data->realAddr);
|
||||||
}
|
}
|
||||||
else{
|
if(DEBUG_LOG_DYN) {
|
||||||
|
DEBUG_FUNCTION_LINE("function_data->restoreInstruction = %08X!\n",function_data->restoreInstruction) ;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
log_printf("Error. Can't save %s for restoring!\n", function_data->function_name);
|
log_printf("Error. Can't save %s for restoring!\n", function_data->function_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -242,9 +249,13 @@ void new_RestoreInvidualInstructions(replacement_data_plugin_t * plugin_data){
|
|||||||
log_printf("Its a dynamic function. We don't need to restore it!\n",function_data->function_name);
|
log_printf("Its a dynamic function. We don't need to restore it!\n",function_data->function_name);
|
||||||
} else {
|
} else {
|
||||||
physical = (u32)OSEffectiveToPhysical((void*)function_data->realAddr); //When its an static function, we need to use the old location
|
physical = (u32)OSEffectiveToPhysical((void*)function_data->realAddr); //When its an static function, we need to use the old location
|
||||||
if(DEBUG_LOG_DYN){DEBUG_FUNCTION_LINE("Restoring %08X to %08X\n",(u32)function_data->restoreInstruction,physical);}
|
if(DEBUG_LOG_DYN) {
|
||||||
|
DEBUG_FUNCTION_LINE("Restoring %08X to %08X\n",(u32)function_data->restoreInstruction,physical);
|
||||||
|
}
|
||||||
SC0x25_KernelCopyData(physical,(u32)&function_data->restoreInstruction, 4);
|
SC0x25_KernelCopyData(physical,(u32)&function_data->restoreInstruction, 4);
|
||||||
if(DEBUG_LOG_DYN){DEBUG_FUNCTION_LINE("ICInvalidateRange %08X\n",(void*)function_data->realAddr);}
|
if(DEBUG_LOG_DYN) {
|
||||||
|
DEBUG_FUNCTION_LINE("ICInvalidateRange %08X\n",(void*)function_data->realAddr);
|
||||||
|
}
|
||||||
ICInvalidateRange((void*)function_data->realAddr, 4);
|
ICInvalidateRange((void*)function_data->realAddr, 4);
|
||||||
DCFlushRange((void*)function_data->realAddr, 4);
|
DCFlushRange((void*)function_data->realAddr, 4);
|
||||||
log_printf("done\n");
|
log_printf("done\n");
|
||||||
@ -265,18 +276,13 @@ s32 new_isDynamicFunction(u32 physicalAddress){
|
|||||||
u32 new_GetAddressOfFunction(const char * functionName,wups_loader_library_type_t library) {
|
u32 new_GetAddressOfFunction(const char * functionName,wups_loader_library_type_t library) {
|
||||||
u32 real_addr = 0;
|
u32 real_addr = 0;
|
||||||
|
|
||||||
if(strcmp(functionName, "OSDynLoad_Acquire") == 0)
|
if(strcmp(functionName, "OSDynLoad_Acquire") == 0) {
|
||||||
{
|
|
||||||
memcpy(&real_addr, &OSDynLoad_Acquire, 4);
|
memcpy(&real_addr, &OSDynLoad_Acquire, 4);
|
||||||
return real_addr;
|
return real_addr;
|
||||||
}
|
} else if(strcmp(functionName, "LiWaitOneChunk") == 0) {
|
||||||
else if(strcmp(functionName, "LiWaitOneChunk") == 0)
|
|
||||||
{
|
|
||||||
real_addr = (u32)addr_LiWaitOneChunk;
|
real_addr = (u32)addr_LiWaitOneChunk;
|
||||||
return real_addr;
|
return real_addr;
|
||||||
}
|
} else if(strcmp(functionName, "LiBounceOneChunk") == 0) {
|
||||||
else if(strcmp(functionName, "LiBounceOneChunk") == 0)
|
|
||||||
{
|
|
||||||
//! not required on firmwares above 3.1.0
|
//! not required on firmwares above 3.1.0
|
||||||
if(OS_FIRMWARE >= 400)
|
if(OS_FIRMWARE >= 400)
|
||||||
return 0;
|
return 0;
|
||||||
@ -296,7 +302,10 @@ u32 new_GetAddressOfFunction(const char * functionName,wups_loader_library_type_
|
|||||||
DEBUG_FUNCTION_LINE("Lets acquire handle for rpl: %s\n",rpl_handles[i].rplname);
|
DEBUG_FUNCTION_LINE("Lets acquire handle for rpl: %s\n",rpl_handles[i].rplname);
|
||||||
OSDynLoad_Acquire(rpl_handles[i].rplname, &rpl_handles[i].handle);
|
OSDynLoad_Acquire(rpl_handles[i].rplname, &rpl_handles[i].handle);
|
||||||
}
|
}
|
||||||
if(rpl_handles[i].handle == 0){log_printf("%s failed to acquire\n",rpl_handles[i].rplname); return 0;}
|
if(rpl_handles[i].handle == 0) {
|
||||||
|
log_printf("%s failed to acquire\n",rpl_handles[i].rplname);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
rpl_handle = rpl_handles[i].handle;
|
rpl_handle = rpl_handles[i].handle;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,9 @@
|
|||||||
#include <utils/logger.h>
|
#include <utils/logger.h>
|
||||||
|
|
||||||
bool ElfTools::elfLoadSection(const Elf *elf, Elf_Scn *scn, const Elf32_Shdr *shdr,void *destination) {
|
bool ElfTools::elfLoadSection(const Elf *elf, Elf_Scn *scn, const Elf32_Shdr *shdr,void *destination) {
|
||||||
if (destination == NULL) { return false; }
|
if (destination == NULL) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
switch (shdr->sh_type) {
|
switch (shdr->sh_type) {
|
||||||
case SHT_SYMTAB:
|
case SHT_SYMTAB:
|
||||||
@ -44,10 +46,12 @@ bool ElfTools::elfLoadSection(const Elf *elf, Elf_Scn *scn, const Elf32_Shdr *sh
|
|||||||
n += data->d_size;
|
n += data->d_size;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} case SHT_NOBITS: {
|
}
|
||||||
|
case SHT_NOBITS: {
|
||||||
memset(destination, 0, shdr->sh_size);
|
memset(destination, 0, shdr->sh_size);
|
||||||
return true;
|
return true;
|
||||||
} default:
|
}
|
||||||
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -158,9 +162,11 @@ bool ElfTools::elfLink(Elf *elf, size_t shndx, void *destination, Elf32_Sym *sym
|
|||||||
case SHN_ABS: {
|
case SHN_ABS: {
|
||||||
symbol_addr = symtab[symbol].st_value;
|
symbol_addr = symtab[symbol].st_value;
|
||||||
break;
|
break;
|
||||||
} case SHN_COMMON: {
|
}
|
||||||
|
case SHN_COMMON: {
|
||||||
return false;
|
return false;
|
||||||
} case SHN_UNDEF: {
|
}
|
||||||
|
case SHN_UNDEF: {
|
||||||
|
|
||||||
if (allow_globals) {
|
if (allow_globals) {
|
||||||
DEBUG_FUNCTION_LINE("The elf still have unresolved relocations. This is not supported.");
|
DEBUG_FUNCTION_LINE("The elf still have unresolved relocations. This is not supported.");
|
||||||
@ -205,7 +211,8 @@ bool ElfTools::elfLink(Elf *elf, size_t shndx, void *destination, Elf32_Sym *sym
|
|||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} default: {
|
}
|
||||||
|
default: {
|
||||||
if (symtab[symbol].st_other != 1) {
|
if (symtab[symbol].st_other != 1) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -220,7 +227,8 @@ bool ElfTools::elfLink(Elf *elf, size_t shndx, void *destination, Elf32_Sym *sym
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
} case SHT_RELA: {
|
}
|
||||||
|
case SHT_RELA: {
|
||||||
const Elf32_Rela *rela;
|
const Elf32_Rela *rela;
|
||||||
Elf_Data *data;
|
Elf_Data *data;
|
||||||
size_t i;
|
size_t i;
|
||||||
@ -247,9 +255,11 @@ bool ElfTools::elfLink(Elf *elf, size_t shndx, void *destination, Elf32_Sym *sym
|
|||||||
case SHN_ABS: {
|
case SHN_ABS: {
|
||||||
symbol_addr = symtab[symbol].st_value;
|
symbol_addr = symtab[symbol].st_value;
|
||||||
break;
|
break;
|
||||||
} case SHN_COMMON: {
|
}
|
||||||
|
case SHN_COMMON: {
|
||||||
return false;
|
return false;
|
||||||
} case SHN_UNDEF: {
|
}
|
||||||
|
case SHN_UNDEF: {
|
||||||
if (allow_globals) {
|
if (allow_globals) {
|
||||||
DEBUG_FUNCTION_LINE("The elf still have unresolved relocations. This is not supported.");
|
DEBUG_FUNCTION_LINE("The elf still have unresolved relocations. This is not supported.");
|
||||||
/*
|
/*
|
||||||
@ -292,7 +302,8 @@ bool ElfTools::elfLink(Elf *elf, size_t shndx, void *destination, Elf32_Sym *sym
|
|||||||
return false;
|
return false;
|
||||||
} else
|
} else
|
||||||
return false;
|
return false;
|
||||||
} default: {
|
}
|
||||||
|
default: {
|
||||||
|
|
||||||
if (symtab[symbol].st_other != 1) {
|
if (symtab[symbol].st_other != 1) {
|
||||||
return false;
|
return false;
|
||||||
@ -333,7 +344,8 @@ bool ElfTools::elfLinkOne(char type, size_t offset, int addend, void *destinatio
|
|||||||
case R_PPC_UADDR16: {
|
case R_PPC_UADDR16: {
|
||||||
value = (int)symbol_addr + addend;
|
value = (int)symbol_addr + addend;
|
||||||
break;
|
break;
|
||||||
} case R_PPC_REL24:
|
}
|
||||||
|
case R_PPC_REL24:
|
||||||
case R_PPC_PLTREL24:
|
case R_PPC_PLTREL24:
|
||||||
case R_PPC_LOCAL24PC:
|
case R_PPC_LOCAL24PC:
|
||||||
case R_PPC_REL14:
|
case R_PPC_REL14:
|
||||||
@ -343,20 +355,23 @@ bool ElfTools::elfLinkOne(char type, size_t offset, int addend, void *destinatio
|
|||||||
case R_PPC_ADDR30: {
|
case R_PPC_ADDR30: {
|
||||||
value = (int)symbol_addr + addend - (int)target;
|
value = (int)symbol_addr + addend - (int)target;
|
||||||
break;
|
break;
|
||||||
} case R_PPC_SECTOFF:
|
}
|
||||||
|
case R_PPC_SECTOFF:
|
||||||
case R_PPC_SECTOFF_LO:
|
case R_PPC_SECTOFF_LO:
|
||||||
case R_PPC_SECTOFF_HI:
|
case R_PPC_SECTOFF_HI:
|
||||||
case R_PPC_SECTOFF_HA: {
|
case R_PPC_SECTOFF_HA: {
|
||||||
value = offset + addend;
|
value = offset + addend;
|
||||||
break;
|
break;
|
||||||
} case R_PPC_EMB_NADDR32:
|
}
|
||||||
|
case R_PPC_EMB_NADDR32:
|
||||||
case R_PPC_EMB_NADDR16:
|
case R_PPC_EMB_NADDR16:
|
||||||
case R_PPC_EMB_NADDR16_LO:
|
case R_PPC_EMB_NADDR16_LO:
|
||||||
case R_PPC_EMB_NADDR16_HI:
|
case R_PPC_EMB_NADDR16_HI:
|
||||||
case R_PPC_EMB_NADDR16_HA: {
|
case R_PPC_EMB_NADDR16_HA: {
|
||||||
value = addend - (int)symbol_addr;
|
value = addend - (int)symbol_addr;
|
||||||
break;
|
break;
|
||||||
} default:
|
}
|
||||||
|
default:
|
||||||
DEBUG_FUNCTION_LINE("Unknown relocation type: %02X\n",type);
|
DEBUG_FUNCTION_LINE("Unknown relocation type: %02X\n",type);
|
||||||
goto exit_error;
|
goto exit_error;
|
||||||
}
|
}
|
||||||
@ -369,54 +384,64 @@ bool ElfTools::elfLinkOne(char type, size_t offset, int addend, void *destinatio
|
|||||||
case R_PPC_EMB_NADDR32: {
|
case R_PPC_EMB_NADDR32: {
|
||||||
*(int *)target = value;
|
*(int *)target = value;
|
||||||
break;
|
break;
|
||||||
} case R_PPC_ADDR24:
|
}
|
||||||
|
case R_PPC_ADDR24:
|
||||||
case R_PPC_PLTREL24:
|
case R_PPC_PLTREL24:
|
||||||
case R_PPC_LOCAL24PC:
|
case R_PPC_LOCAL24PC:
|
||||||
case R_PPC_REL24: {
|
case R_PPC_REL24: {
|
||||||
*(int *)target =
|
*(int *)target =
|
||||||
(*(int *)target & 0xfc000003) | (value & 0x03fffffc);
|
(*(int *)target & 0xfc000003) | (value & 0x03fffffc);
|
||||||
break;
|
break;
|
||||||
} case R_PPC_ADDR16:
|
}
|
||||||
|
case R_PPC_ADDR16:
|
||||||
case R_PPC_UADDR16:
|
case R_PPC_UADDR16:
|
||||||
case R_PPC_EMB_NADDR16: {
|
case R_PPC_EMB_NADDR16: {
|
||||||
*(short *)target = value;
|
*(short *)target = value;
|
||||||
break;
|
break;
|
||||||
} case R_PPC_ADDR16_HI:
|
}
|
||||||
|
case R_PPC_ADDR16_HI:
|
||||||
case R_PPC_SECTOFF_HI:
|
case R_PPC_SECTOFF_HI:
|
||||||
case R_PPC_EMB_NADDR16_HI: {
|
case R_PPC_EMB_NADDR16_HI: {
|
||||||
*(short *)target = value >> 16;
|
*(short *)target = value >> 16;
|
||||||
break;
|
break;
|
||||||
} case R_PPC_ADDR16_HA:
|
}
|
||||||
|
case R_PPC_ADDR16_HA:
|
||||||
case R_PPC_SECTOFF_HA:
|
case R_PPC_SECTOFF_HA:
|
||||||
case R_PPC_EMB_NADDR16_HA: {
|
case R_PPC_EMB_NADDR16_HA: {
|
||||||
*(short *)target = (value >> 16) + ((value >> 15) & 1);
|
*(short *)target = (value >> 16) + ((value >> 15) & 1);
|
||||||
break;
|
break;
|
||||||
} case R_PPC_ADDR16_LO:
|
}
|
||||||
|
case R_PPC_ADDR16_LO:
|
||||||
case R_PPC_SECTOFF_LO:
|
case R_PPC_SECTOFF_LO:
|
||||||
case R_PPC_EMB_NADDR16_LO: {
|
case R_PPC_EMB_NADDR16_LO: {
|
||||||
*(short *)target = value & 0xffff;
|
*(short *)target = value & 0xffff;
|
||||||
break;
|
break;
|
||||||
} case R_PPC_ADDR14:
|
}
|
||||||
|
case R_PPC_ADDR14:
|
||||||
case R_PPC_REL14: {
|
case R_PPC_REL14: {
|
||||||
*(int *)target =
|
*(int *)target =
|
||||||
(*(int *)target & 0xffff0003) | (value & 0x0000fffc);
|
(*(int *)target & 0xffff0003) | (value & 0x0000fffc);
|
||||||
break;
|
break;
|
||||||
} case R_PPC_ADDR14_BRTAKEN:
|
}
|
||||||
|
case R_PPC_ADDR14_BRTAKEN:
|
||||||
case R_PPC_REL14_BRTAKEN: {
|
case R_PPC_REL14_BRTAKEN: {
|
||||||
*(int *)target =
|
*(int *)target =
|
||||||
(*(int *)target & 0xffdf0003) | (value & 0x0000fffc) |
|
(*(int *)target & 0xffdf0003) | (value & 0x0000fffc) |
|
||||||
0x00200000;
|
0x00200000;
|
||||||
break;
|
break;
|
||||||
} case R_PPC_ADDR14_BRNTAKEN:
|
}
|
||||||
|
case R_PPC_ADDR14_BRNTAKEN:
|
||||||
case R_PPC_REL14_BRNTAKEN: {
|
case R_PPC_REL14_BRNTAKEN: {
|
||||||
*(int *)target =
|
*(int *)target =
|
||||||
(*(int *)target & 0xffdf0003) | (value & 0x0000fffc);
|
(*(int *)target & 0xffdf0003) | (value & 0x0000fffc);
|
||||||
break;
|
break;
|
||||||
} case R_PPC_ADDR30: {
|
}
|
||||||
|
case R_PPC_ADDR30: {
|
||||||
*(int *)target =
|
*(int *)target =
|
||||||
(*(int *)target & 0x00000003) | (value & 0xfffffffc);
|
(*(int *)target & 0x00000003) | (value & 0xfffffffc);
|
||||||
break;
|
break;
|
||||||
}default:
|
}
|
||||||
|
default:
|
||||||
goto exit_error;
|
goto exit_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,8 +122,12 @@ bool PluginInformation::parseElf( Elf *elf) {
|
|||||||
|
|
||||||
const char * path_c = getPath().c_str();
|
const char * path_c = getPath().c_str();
|
||||||
|
|
||||||
if(elf == NULL){ goto exit_error; }
|
if(elf == NULL) {
|
||||||
if(elf_kind(elf) != ELF_K_ELF){ goto exit_error; }
|
goto exit_error;
|
||||||
|
}
|
||||||
|
if(elf_kind(elf) != ELF_K_ELF) {
|
||||||
|
goto exit_error;
|
||||||
|
}
|
||||||
|
|
||||||
ident = elf_getident(elf, &sz);
|
ident = elf_getident(elf, &sz);
|
||||||
|
|
||||||
@ -172,7 +176,9 @@ bool PluginInformation::parseElf( Elf *elf) {
|
|||||||
goto exit_error;
|
goto exit_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(symtab == NULL){ goto exit_error; }
|
if(symtab == NULL) {
|
||||||
|
goto exit_error;
|
||||||
|
}
|
||||||
|
|
||||||
if(!metadataRead(elf, symtab, symtab_count, symtab_strndx)) {
|
if(!metadataRead(elf, symtab, symtab_count, symtab_strndx)) {
|
||||||
goto exit_error;
|
goto exit_error;
|
||||||
|
@ -42,18 +42,15 @@ CSettings::CSettings(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
CSettings::~CSettings() {
|
CSettings::~CSettings() {
|
||||||
for(u32 i = 0; i < settingsValues.size(); i++)
|
for(u32 i = 0; i < settingsValues.size(); i++) {
|
||||||
{
|
|
||||||
if(settingsValues[i].dataType == TypeString)
|
if(settingsValues[i].dataType == TypeString)
|
||||||
delete settingsValues[i].strValue;
|
delete settingsValues[i].strValue;
|
||||||
}
|
}
|
||||||
delete nullValue.strValue;
|
delete nullValue.strValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettings::SetDefault()
|
void CSettings::SetDefault() {
|
||||||
{
|
for(u32 i = 0; i < settingsValues.size(); i++) {
|
||||||
for(u32 i = 0; i < settingsValues.size(); i++)
|
|
||||||
{
|
|
||||||
if(settingsValues[i].dataType == TypeString)
|
if(settingsValues[i].dataType == TypeString)
|
||||||
delete settingsValues[i].strValue;
|
delete settingsValues[i].strValue;
|
||||||
}
|
}
|
||||||
@ -89,8 +86,7 @@ bool CSettings::Load(){
|
|||||||
|
|
||||||
//! remove all windows crap signs
|
//! remove all windows crap signs
|
||||||
size_t position;
|
size_t position;
|
||||||
while(1 && !strBuffer.empty())
|
while(1 && !strBuffer.empty()) {
|
||||||
{
|
|
||||||
position = strBuffer.find('\r');
|
position = strBuffer.find('\r');
|
||||||
if(position == std::string::npos)
|
if(position == std::string::npos)
|
||||||
break;
|
break;
|
||||||
@ -104,8 +100,7 @@ bool CSettings::Load(){
|
|||||||
if(lines.empty() || !ValidVersion(lines[0]))
|
if(lines.empty() || !ValidVersion(lines[0]))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for(u32 i = 0; i < lines.size(); ++i)
|
for(u32 i = 0; i < lines.size(); ++i) {
|
||||||
{
|
|
||||||
std::vector<std::string> valueSplit = StringTools::stringSplit(lines[i], "=");
|
std::vector<std::string> valueSplit = StringTools::stringSplit(lines[i], "=");
|
||||||
if(valueSplit.size() != 2)
|
if(valueSplit.size() != 2)
|
||||||
continue;
|
continue;
|
||||||
@ -116,15 +111,12 @@ bool CSettings::Load(){
|
|||||||
while((valueSplit[1].size() > 0) && valueSplit[1][ valueSplit[1].size() - 1 ] == ' ')
|
while((valueSplit[1].size() > 0) && valueSplit[1][ valueSplit[1].size() - 1 ] == ' ')
|
||||||
valueSplit[1].resize(valueSplit[1].size() - 1);
|
valueSplit[1].resize(valueSplit[1].size() - 1);
|
||||||
|
|
||||||
for(u32 n = 0; n < settingsNames.size(); n++)
|
for(u32 n = 0; n < settingsNames.size(); n++) {
|
||||||
{
|
|
||||||
if(!settingsNames[n])
|
if(!settingsNames[n])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if(valueSplit[0] == settingsNames[n])
|
if(valueSplit[0] == settingsNames[n]) {
|
||||||
{
|
switch(settingsValues[n].dataType) {
|
||||||
switch(settingsValues[n].dataType)
|
|
||||||
{
|
|
||||||
case TypeBool:
|
case TypeBool:
|
||||||
settingsValues[n].bValue = atoi(valueSplit[1].c_str());
|
settingsValues[n].bValue = atoi(valueSplit[1].c_str());
|
||||||
break;
|
break;
|
||||||
@ -201,10 +193,8 @@ bool CSettings::Save(){
|
|||||||
|
|
||||||
file.fwrite("%s%i\n", VERSION_LINE, VALID_VERSION);
|
file.fwrite("%s%i\n", VERSION_LINE, VALID_VERSION);
|
||||||
|
|
||||||
for(u32 i = 0; i < settingsValues.size(); i++)
|
for(u32 i = 0; i < settingsValues.size(); i++) {
|
||||||
{
|
switch(settingsValues[i].dataType) {
|
||||||
switch(settingsValues[i].dataType)
|
|
||||||
{
|
|
||||||
case TypeBool:
|
case TypeBool:
|
||||||
file.fwrite("%s=%i\n", settingsNames[i], settingsValues[i].bValue);
|
file.fwrite("%s=%i\n", settingsNames[i], settingsValues[i].bValue);
|
||||||
break;
|
break;
|
||||||
|
@ -25,8 +25,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include "SettingsEnums.h"
|
#include "SettingsEnums.h"
|
||||||
|
|
||||||
class CSettings
|
class CSettings {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
static CSettings *instance() {
|
static CSettings *instance() {
|
||||||
if(!settingsInstance)
|
if(!settingsInstance)
|
||||||
@ -71,146 +70,118 @@ public:
|
|||||||
MAX_VALUE
|
MAX_VALUE
|
||||||
};
|
};
|
||||||
|
|
||||||
static const u8 & getDataType(int idx)
|
static const u8 & getDataType(int idx) {
|
||||||
{
|
|
||||||
if(idx > INVALID && idx < MAX_VALUE)
|
if(idx > INVALID && idx < MAX_VALUE)
|
||||||
return instance()->settingsValues[idx].dataType;
|
return instance()->settingsValues[idx].dataType;
|
||||||
|
|
||||||
return instance()->nullValue.dataType;
|
return instance()->nullValue.dataType;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const bool & getValueAsBool(int idx)
|
static const bool & getValueAsBool(int idx) {
|
||||||
{
|
|
||||||
if(idx > INVALID && idx < MAX_VALUE && instance()->settingsValues[idx].dataType == TypeBool)
|
if(idx > INVALID && idx < MAX_VALUE && instance()->settingsValues[idx].dataType == TypeBool)
|
||||||
return instance()->settingsValues[idx].bValue;
|
return instance()->settingsValues[idx].bValue;
|
||||||
|
|
||||||
return instance()->nullValue.bValue;
|
return instance()->nullValue.bValue;
|
||||||
}
|
}
|
||||||
static const s8 & getValueAsS8(int idx)
|
static const s8 & getValueAsS8(int idx) {
|
||||||
{
|
|
||||||
if(idx > INVALID && idx < MAX_VALUE && instance()->settingsValues[idx].dataType == TypeS8)
|
if(idx > INVALID && idx < MAX_VALUE && instance()->settingsValues[idx].dataType == TypeS8)
|
||||||
return instance()->settingsValues[idx].cValue;
|
return instance()->settingsValues[idx].cValue;
|
||||||
|
|
||||||
return instance()->nullValue.cValue;
|
return instance()->nullValue.cValue;
|
||||||
}
|
}
|
||||||
static const u8 & getValueAsU8(int idx)
|
static const u8 & getValueAsU8(int idx) {
|
||||||
{
|
|
||||||
if(idx > INVALID && idx < MAX_VALUE && instance()->settingsValues[idx].dataType == TypeU8)
|
if(idx > INVALID && idx < MAX_VALUE && instance()->settingsValues[idx].dataType == TypeU8)
|
||||||
return instance()->settingsValues[idx].ucValue;
|
return instance()->settingsValues[idx].ucValue;
|
||||||
|
|
||||||
return instance()->nullValue.ucValue;
|
return instance()->nullValue.ucValue;
|
||||||
}
|
}
|
||||||
static const s16 & getValueAsS16(int idx)
|
static const s16 & getValueAsS16(int idx) {
|
||||||
{
|
|
||||||
if(idx > INVALID && idx < MAX_VALUE && instance()->settingsValues[idx].dataType == TypeS16)
|
if(idx > INVALID && idx < MAX_VALUE && instance()->settingsValues[idx].dataType == TypeS16)
|
||||||
return instance()->settingsValues[idx].sValue;
|
return instance()->settingsValues[idx].sValue;
|
||||||
|
|
||||||
return instance()->nullValue.sValue;
|
return instance()->nullValue.sValue;
|
||||||
}
|
}
|
||||||
static const u16 & getValueAsU16(int idx)
|
static const u16 & getValueAsU16(int idx) {
|
||||||
{
|
|
||||||
if(idx > INVALID && idx < MAX_VALUE && instance()->settingsValues[idx].dataType == TypeU16)
|
if(idx > INVALID && idx < MAX_VALUE && instance()->settingsValues[idx].dataType == TypeU16)
|
||||||
return instance()->settingsValues[idx].usValue;
|
return instance()->settingsValues[idx].usValue;
|
||||||
|
|
||||||
return instance()->nullValue.usValue;
|
return instance()->nullValue.usValue;
|
||||||
}
|
}
|
||||||
static const s32 & getValueAsS32(int idx)
|
static const s32 & getValueAsS32(int idx) {
|
||||||
{
|
|
||||||
if(idx > INVALID && idx < MAX_VALUE && instance()->settingsValues[idx].dataType == TypeS32)
|
if(idx > INVALID && idx < MAX_VALUE && instance()->settingsValues[idx].dataType == TypeS32)
|
||||||
return instance()->settingsValues[idx].iValue;
|
return instance()->settingsValues[idx].iValue;
|
||||||
|
|
||||||
return instance()->nullValue.iValue;
|
return instance()->nullValue.iValue;
|
||||||
}
|
}
|
||||||
static const u32 & getValueAsU32(int idx)
|
static const u32 & getValueAsU32(int idx) {
|
||||||
{
|
|
||||||
if(idx > INVALID && idx < MAX_VALUE && instance()->settingsValues[idx].dataType == TypeU32)
|
if(idx > INVALID && idx < MAX_VALUE && instance()->settingsValues[idx].dataType == TypeU32)
|
||||||
return instance()->settingsValues[idx].uiValue;
|
return instance()->settingsValues[idx].uiValue;
|
||||||
|
|
||||||
return instance()->nullValue.uiValue;
|
return instance()->nullValue.uiValue;
|
||||||
}
|
}
|
||||||
static const f32 & getValueAsF32(int idx)
|
static const f32 & getValueAsF32(int idx) {
|
||||||
{
|
|
||||||
if(idx > INVALID && idx < MAX_VALUE && instance()->settingsValues[idx].dataType == TypeF32)
|
if(idx > INVALID && idx < MAX_VALUE && instance()->settingsValues[idx].dataType == TypeF32)
|
||||||
return instance()->settingsValues[idx].fValue;
|
return instance()->settingsValues[idx].fValue;
|
||||||
|
|
||||||
return instance()->nullValue.fValue;
|
return instance()->nullValue.fValue;
|
||||||
}
|
}
|
||||||
static const std::string & getValueAsString(int idx)
|
static const std::string & getValueAsString(int idx) {
|
||||||
{
|
|
||||||
if(idx > INVALID && idx < MAX_VALUE && instance()->settingsValues[idx].dataType == TypeString && instance()->settingsValues[idx].strValue)
|
if(idx > INVALID && idx < MAX_VALUE && instance()->settingsValues[idx].dataType == TypeString && instance()->settingsValues[idx].strValue)
|
||||||
return *(instance()->settingsValues[idx].strValue);
|
return *(instance()->settingsValues[idx].strValue);
|
||||||
|
|
||||||
return *(instance()->nullValue.strValue);
|
return *(instance()->nullValue.strValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setValueAsBool(int idx, const bool & val)
|
static void setValueAsBool(int idx, const bool & val) {
|
||||||
{
|
if(idx > INVALID && idx < MAX_VALUE && instance()->settingsValues[idx].dataType == TypeBool) {
|
||||||
if(idx > INVALID && idx < MAX_VALUE && instance()->settingsValues[idx].dataType == TypeBool)
|
|
||||||
{
|
|
||||||
instance()->settingsValues[idx].bValue = val;
|
instance()->settingsValues[idx].bValue = val;
|
||||||
instance()->bChanged = true;
|
instance()->bChanged = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static void setValueAsS8(int idx, const s8 & val)
|
static void setValueAsS8(int idx, const s8 & val) {
|
||||||
{
|
if(idx > INVALID && idx < MAX_VALUE && instance()->settingsValues[idx].dataType == TypeS8) {
|
||||||
if(idx > INVALID && idx < MAX_VALUE && instance()->settingsValues[idx].dataType == TypeS8)
|
|
||||||
{
|
|
||||||
instance()->settingsValues[idx].cValue = val;
|
instance()->settingsValues[idx].cValue = val;
|
||||||
instance()->bChanged = true;
|
instance()->bChanged = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static void setValueAsU8(int idx, const u8 & val)
|
static void setValueAsU8(int idx, const u8 & val) {
|
||||||
{
|
if(idx > INVALID && idx < MAX_VALUE && instance()->settingsValues[idx].dataType == TypeU8) {
|
||||||
if(idx > INVALID && idx < MAX_VALUE && instance()->settingsValues[idx].dataType == TypeU8)
|
|
||||||
{
|
|
||||||
instance()->settingsValues[idx].ucValue = val;
|
instance()->settingsValues[idx].ucValue = val;
|
||||||
instance()->bChanged = true;
|
instance()->bChanged = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static void setValueAsS16(int idx, const s16 & val)
|
static void setValueAsS16(int idx, const s16 & val) {
|
||||||
{
|
if(idx > INVALID && idx < MAX_VALUE && instance()->settingsValues[idx].dataType == TypeS16) {
|
||||||
if(idx > INVALID && idx < MAX_VALUE && instance()->settingsValues[idx].dataType == TypeS16)
|
|
||||||
{
|
|
||||||
instance()->settingsValues[idx].sValue = val;
|
instance()->settingsValues[idx].sValue = val;
|
||||||
instance()->bChanged = true;
|
instance()->bChanged = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static void setValueAsU16(int idx, const u16 & val)
|
static void setValueAsU16(int idx, const u16 & val) {
|
||||||
{
|
if(idx > INVALID && idx < MAX_VALUE && instance()->settingsValues[idx].dataType == TypeU16) {
|
||||||
if(idx > INVALID && idx < MAX_VALUE && instance()->settingsValues[idx].dataType == TypeU16)
|
|
||||||
{
|
|
||||||
instance()->settingsValues[idx].usValue = val;
|
instance()->settingsValues[idx].usValue = val;
|
||||||
instance()->bChanged = true;
|
instance()->bChanged = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static void setValueAsS32(int idx, const s32 & val)
|
static void setValueAsS32(int idx, const s32 & val) {
|
||||||
{
|
if(idx > INVALID && idx < MAX_VALUE && instance()->settingsValues[idx].dataType == TypeS32) {
|
||||||
if(idx > INVALID && idx < MAX_VALUE && instance()->settingsValues[idx].dataType == TypeS32)
|
|
||||||
{
|
|
||||||
instance()->settingsValues[idx].iValue = val;
|
instance()->settingsValues[idx].iValue = val;
|
||||||
instance()->bChanged = true;
|
instance()->bChanged = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static void setValueAsU32(int idx, const u32 & val)
|
static void setValueAsU32(int idx, const u32 & val) {
|
||||||
{
|
if(idx > INVALID && idx < MAX_VALUE && instance()->settingsValues[idx].dataType == TypeU32) {
|
||||||
if(idx > INVALID && idx < MAX_VALUE && instance()->settingsValues[idx].dataType == TypeU32)
|
|
||||||
{
|
|
||||||
instance()->settingsValues[idx].uiValue = val;
|
instance()->settingsValues[idx].uiValue = val;
|
||||||
instance()->bChanged = true;
|
instance()->bChanged = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static void setValueAsF32(int idx, const f32 & val)
|
static void setValueAsF32(int idx, const f32 & val) {
|
||||||
{
|
if(idx > INVALID && idx < MAX_VALUE && instance()->settingsValues[idx].dataType == TypeF32) {
|
||||||
if(idx > INVALID && idx < MAX_VALUE && instance()->settingsValues[idx].dataType == TypeF32)
|
|
||||||
{
|
|
||||||
instance()->settingsValues[idx].fValue = val;
|
instance()->settingsValues[idx].fValue = val;
|
||||||
instance()->bChanged = true;
|
instance()->bChanged = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static void setValueAsString(int idx, const std::string & val)
|
static void setValueAsString(int idx, const std::string & val) {
|
||||||
{
|
if(idx > INVALID && idx < MAX_VALUE && instance()->settingsValues[idx].dataType == TypeString && instance()->settingsValues[idx].strValue) {
|
||||||
if(idx > INVALID && idx < MAX_VALUE && instance()->settingsValues[idx].dataType == TypeString && instance()->settingsValues[idx].strValue)
|
|
||||||
{
|
|
||||||
*(instance()->settingsValues[idx].strValue) = val;
|
*(instance()->settingsValues[idx].strValue) = val;
|
||||||
instance()->bChanged = true;
|
instance()->bChanged = true;
|
||||||
}
|
}
|
||||||
@ -225,12 +196,10 @@ protected:
|
|||||||
|
|
||||||
static CSettings *settingsInstance;
|
static CSettings *settingsInstance;
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
u8 dataType;
|
u8 dataType;
|
||||||
|
|
||||||
union
|
union {
|
||||||
{
|
|
||||||
bool bValue;
|
bool bValue;
|
||||||
s8 cValue;
|
s8 cValue;
|
||||||
u8 ucValue;
|
u8 ucValue;
|
||||||
|
@ -19,19 +19,16 @@
|
|||||||
#ifndef __SETTINGS_DEFS_
|
#ifndef __SETTINGS_DEFS_
|
||||||
#define __SETTINGS_DEFS_
|
#define __SETTINGS_DEFS_
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
int value;
|
int value;
|
||||||
const char *name;
|
const char *name;
|
||||||
} ValueString;
|
} ValueString;
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
const char *name;
|
const char *name;
|
||||||
const ValueString *valueStrings;
|
const ValueString *valueStrings;
|
||||||
int type;
|
int type;
|
||||||
int index;
|
int index;
|
||||||
} SettingType;
|
} SettingType;
|
||||||
|
|
||||||
|
|
||||||
#endif // __SETTINGS_DEFS_
|
#endif // __SETTINGS_DEFS_
|
||||||
|
Loading…
x
Reference in New Issue
Block a user