04-07-2021, 01:32 PM
my code (not doing anything, not copying any files)
#include <stdio.h>
#include <stdlib.h>
#include <gccore.h>
#include <grrlib.h>
#include <stdio.h>
#include <fstream>
#include <wiiuse/wpad.h>
#include <time.h>
#include "RobotoBold_ttf.h"
#include "pointer_png.h"
#include "background_png.h"
#include <unistd.h>
#include <ogcsys.h>
#define pressed_quit() (WPAD_ButtonsDown(0)&WPAD_BUTTON_HOME)
#define held() (WPAD_ButtonsHeld(0)&WPAD_BUTTON_A)
using namespace std;
#define WSP_POINTER_CORRECTION_X 200
#define WSP_POINTER_CORRECTION_Y 250
int main()
{
u32 white=0xFFFFFFFF;
u32 reserved=0xFFFFFFFF;
u32 selected=0xEEEEEE99;
const int screenWidth=640;
const int screenHeight=480;
const int defaultWidth=120;
float copyButtonWidth=defaultWidth*3;
int copyButtonHeight=defaultWidth;
int copyButtonX=(screenWidth/2)-(copyButtonWidth/2);
int copyButtonY=(screenHeight/2)-(copyButtonHeight/2);
GRRLIB_Init();
WPAD_Init();
WPAD_SetDataFormat(0, WPAD_FMT_BTNS_ACC_IR);
GRRLIB_ttfFont *robotoBold=GRRLIB_LoadTTF(RobotoBold_ttf, RobotoBold_ttf_size);
GRRLIB_texImg *pointer=GRRLIB_LoadTexture(pointer_png);
GRRLIB_texImg *background=GRRLIB_LoadTexture(background_png);
string copyNKWii="Copy MKWii Save To NKWii";
while (1)
{
WPAD_ScanPads();
ir_t ir;
ISFS_Initialize();
SYS_Init();
WPAD_IR(WPAD_CHAN_0, &ir);
GRRLIB_DrawImg(0, 0, background, 0, 1, 1, white);
int pointerX=(ir.sx-WSP_POINTER_CORRECTION_X);
int pointerY=(ir.sy-WSP_POINTER_CORRECTION_Y);
GRRLIB_Rectangle(copyButtonX, copyButtonY, copyButtonWidth, copyButtonHeight, reserved, true);
GRRLIB_PrintfTTF(copyButtonX+30, copyButtonY+(copyButtonHeight/2)-11, robotoBold, copyNKWii.c_str(), 23, 0x000000FF);
GRRLIB_DrawImg(pointerX, pointerY, pointer, ir.angle, 1, 1, 0xFFFFFFFF);
if (pointerX>=copyButtonX&&pointerX<=screenWidth-copyButtonX&&pointerY>=copyButtonY&&pointerY<=screenHeight-copyButtonY&&held()) {
reserved=0x0A0A0A87;
string defaultPath="nand:/title/00010004/524d4345/data/";
string nkwiiPath="nand:/title/00010004/4a4e4b57/data/";
string mkwiiFiles[]={"banner.bin", "rksys.dat", "wc24dl.vff", "wc24scr.vff"};
string srcPaths[]={defaultPath+mkwiiFiles[0], defaultPath+mkwiiFiles[1], defaultPath+mkwiiFiles[2], defaultPath+mkwiiFiles[3]};
string dstPaths[]={nkwiiPath+mkwiiFiles[0], nkwiiPath+mkwiiFiles[1], nkwiiPath+mkwiiFiles[2], nkwiiPath+mkwiiFiles[3]};
for (int loopCounter=0; loopCounter<4; loopCounter++) {
string src=srcPaths[loopCounter];
string dst=dstPaths[loopCounter];
std::ifstream src_f(src, std::ios::binary);
std::ofstream dst_f(dst, std::ios::binary);
std::ifstream lastFile(dstPaths[3], std::ios::binary);
std::ifstream firstFile(to_string(ISFS_MAXPATH).c_str(), std::ios::binary);
if (!firstFile) {
copyNKWii="File Path Is Invalid.";
}
else {
copyNKWii="File Path Is Vaild.";
}
if (lastFile) {
copyNKWii="Files Succsesfully Copied.";
}
dst_f << src_f.rdbuf();
}
}
if (pointerX>=copyButtonX&&pointerX<=screenWidth-copyButtonX&&pointerY>=copyButtonY&&pointerY<=screenHeight-copyButtonY) {
reserved=selected;
}
else {
reserved=0xEAEAEA87;
}
if (pressed_quit())
{
break;
}
GRRLIB_Render();
}
GRRLIB_FreeTTF(robotoBold);
GRRLIB_FreeTexture(pointer);
GRRLIB_FreeTexture(background);
GRRLIB_Exit();
exit(0);
}
fyi, devkitpro doesn't show any errors
#include <stdio.h>
#include <stdlib.h>
#include <gccore.h>
#include <grrlib.h>
#include <stdio.h>
#include <fstream>
#include <wiiuse/wpad.h>
#include <time.h>
#include "RobotoBold_ttf.h"
#include "pointer_png.h"
#include "background_png.h"
#include <unistd.h>
#include <ogcsys.h>
#define pressed_quit() (WPAD_ButtonsDown(0)&WPAD_BUTTON_HOME)
#define held() (WPAD_ButtonsHeld(0)&WPAD_BUTTON_A)
using namespace std;
#define WSP_POINTER_CORRECTION_X 200
#define WSP_POINTER_CORRECTION_Y 250
int main()
{
u32 white=0xFFFFFFFF;
u32 reserved=0xFFFFFFFF;
u32 selected=0xEEEEEE99;
const int screenWidth=640;
const int screenHeight=480;
const int defaultWidth=120;
float copyButtonWidth=defaultWidth*3;
int copyButtonHeight=defaultWidth;
int copyButtonX=(screenWidth/2)-(copyButtonWidth/2);
int copyButtonY=(screenHeight/2)-(copyButtonHeight/2);
GRRLIB_Init();
WPAD_Init();
WPAD_SetDataFormat(0, WPAD_FMT_BTNS_ACC_IR);
GRRLIB_ttfFont *robotoBold=GRRLIB_LoadTTF(RobotoBold_ttf, RobotoBold_ttf_size);
GRRLIB_texImg *pointer=GRRLIB_LoadTexture(pointer_png);
GRRLIB_texImg *background=GRRLIB_LoadTexture(background_png);
string copyNKWii="Copy MKWii Save To NKWii";
while (1)
{
WPAD_ScanPads();
ir_t ir;
ISFS_Initialize();
SYS_Init();
WPAD_IR(WPAD_CHAN_0, &ir);
GRRLIB_DrawImg(0, 0, background, 0, 1, 1, white);
int pointerX=(ir.sx-WSP_POINTER_CORRECTION_X);
int pointerY=(ir.sy-WSP_POINTER_CORRECTION_Y);
GRRLIB_Rectangle(copyButtonX, copyButtonY, copyButtonWidth, copyButtonHeight, reserved, true);
GRRLIB_PrintfTTF(copyButtonX+30, copyButtonY+(copyButtonHeight/2)-11, robotoBold, copyNKWii.c_str(), 23, 0x000000FF);
GRRLIB_DrawImg(pointerX, pointerY, pointer, ir.angle, 1, 1, 0xFFFFFFFF);
if (pointerX>=copyButtonX&&pointerX<=screenWidth-copyButtonX&&pointerY>=copyButtonY&&pointerY<=screenHeight-copyButtonY&&held()) {
reserved=0x0A0A0A87;
string defaultPath="nand:/title/00010004/524d4345/data/";
string nkwiiPath="nand:/title/00010004/4a4e4b57/data/";
string mkwiiFiles[]={"banner.bin", "rksys.dat", "wc24dl.vff", "wc24scr.vff"};
string srcPaths[]={defaultPath+mkwiiFiles[0], defaultPath+mkwiiFiles[1], defaultPath+mkwiiFiles[2], defaultPath+mkwiiFiles[3]};
string dstPaths[]={nkwiiPath+mkwiiFiles[0], nkwiiPath+mkwiiFiles[1], nkwiiPath+mkwiiFiles[2], nkwiiPath+mkwiiFiles[3]};
for (int loopCounter=0; loopCounter<4; loopCounter++) {
string src=srcPaths[loopCounter];
string dst=dstPaths[loopCounter];
std::ifstream src_f(src, std::ios::binary);
std::ofstream dst_f(dst, std::ios::binary);
std::ifstream lastFile(dstPaths[3], std::ios::binary);
std::ifstream firstFile(to_string(ISFS_MAXPATH).c_str(), std::ios::binary);
if (!firstFile) {
copyNKWii="File Path Is Invalid.";
}
else {
copyNKWii="File Path Is Vaild.";
}
if (lastFile) {
copyNKWii="Files Succsesfully Copied.";
}
dst_f << src_f.rdbuf();
}
}
if (pointerX>=copyButtonX&&pointerX<=screenWidth-copyButtonX&&pointerY>=copyButtonY&&pointerY<=screenHeight-copyButtonY) {
reserved=selected;
}
else {
reserved=0xEAEAEA87;
}
if (pressed_quit())
{
break;
}
GRRLIB_Render();
}
GRRLIB_FreeTTF(robotoBold);
GRRLIB_FreeTexture(pointer);
GRRLIB_FreeTexture(background);
GRRLIB_Exit();
exit(0);
}
fyi, devkitpro doesn't show any errors