06.02.2011, 21:09
Ich wollte zum lernen von C und zum coden, PSCrypter im VLF-Style machen, also habe ich ein wenig herum gespielt.
Wenn ich es kompilieren will, kommt aber:
Kann mir jemand helfen, ich habe bereits alle include dateien verglichen genauso wie die Makefiles.
Die Makefile von dem Port
In meiner main.c steht folgendes:
Wenn ich es kompilieren will, kommt aber:
Spoiler: (anzeigen)
Code:
main.o: In function `main_fix_realocations':
main.c:(.text+0x370): undefined reference to `pspDebugScreenPrintf'
main.c:(.text+0x4a8): undefined reference to `pspDebugScreenPrintf'
main.c:(.text+0x4d8): undefined reference to `pspDebugScreenPrintf'
main.o: In function `main_pack_pbp':
main.c:(.text+0x578): undefined reference to `pspDebugScreenPrintf'
main.c:(.text+0x608): undefined reference to `pspDebugScreenPrintf'
main.o:main.c:(.text+0x650): more undefined references to `pspDebugScreenPrintf'
follow
kirk_engine.o: In function `kirk_init':
kirk_engine.c:(.text+0x7f4): undefined reference to `time'
collect2: ld returned 1 exit status
make: *** [sample.elf] Error 1
Die Makefile von dem Port
Spoiler: (anzeigen)
Code:
TARGET = sample
OBJS = crt0.o main.o crypto.o kirk_engine.o
INCDIR = ../../include
CFLAGS = -O2 -G0 -Wall -fshort-wchar -fno-pic -mno-check-zero-division
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS) -c
LIBDIR = ../../lib
LDFLAGS = -mno-crt0 -nostdlib -nodefaultlibs
LIBS = -lvlfgui -lvlfgu -lvlfutils -lvlflibc -lpsppower
PSP_FW_VERSION = 150
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = PSCRYPTER V3.0
PSP_EBOOT_ICON = icon0.png
BUILD_PRX = 1
PSP_LARGE_MEMORY = 1
PSPSDK=$(shell psp-config --pspsdk-path)
include ./build.mak
Achtung unübersichtlicher Code (anzeigen)
Code:
#include <pspsdk.h>
#include <psputility.h>
#include <pspkernel.h>
#include <pspdebug.h>
#include <pspctrl.h>
#include <pspsuspend.h>
#include <psppower.h>
#include <pspreg.h>
#include <psprtc.h>
#include <psputils.h>
#include <pspgu.h>
#include <pspgum.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stdarg.h>
#include <time.h>
#include <malloc.h>
#include <sys/unistd.h>
#include <vlf.h>
PSP_MODULE_INFO("PSCRYPTERv3.0", 0, 1, 0);
PSP_MAIN_THREAD_ATTR(0);
int err = 0;
#define MAX_BUFFER_SIZE 1024*1024*5+1024*512
#define MAX_ORIGIN_FILE_SIZE 1024*1024*4
#define printf pspDebugScreenPrintf
#include "main_crypter.h"
#include "unpack-pbp.h"
#include "pack-pbp.h"
#include "fix-realocations.h"
typedef struct _SampleConfiguration
{
u16 username[32];
u16 password[32];
} SampleConfiguration;
int exit_callback(int arg1, int arg2, void *common)
{
sceKernelExitGame();
return 0;
}
int CallbackThread(SceSize args, void *argp)
{
int cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
sceKernelRegisterExitCallback(cbid);
sceKernelSleepThreadCB();
return 0;
}
int SetupCallbacks(void)
{
int thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0);
if (thid >= 0)
sceKernelStartThread(thid, 0, 0);
return thid;
}
char *filename_list[10] = {
"name","EBOOT_signed.PBP", "param.sfo", "icon0.png", "icon1.pmf", "pic0.png", "pic1.png", "snd0.at3", "data.psp", "data.psar"
};
// ENDE
char *license_text =
"PSCRYPTER v2.0 by Carlosgs.\n\n"
"Encrypt EBOOT.PBP files directly\n"
"from the PSP\n\n"
"Uses the code made by 'bbtgp'\n"
"and parts of the PSPSDK\n\n"
"2.0 added realocation fixing by JJS\n"
"THANK YOU!";
//SampleConfiguration config;
VlfPicture logo;
VlfText license, do_you_agree;
int focus;
VlfText username_label, password_label, crypter, signin;
VlfInputBox username, password;
VlfCheckBox rp;
int OnExit(int enter)
{
if (enter)
sceKernelExitGame();
return VLF_EV_RET_NOTHING;
}
/*
void OnSaveConfig(void *param)
{
int savepassword = (int)param;
if (!savepassword)
memset(config.password, 0, 32);
SceUID fd = sceIoOpen("config.bin", PSP_O_WRONLY | PSP_O_TRUNC | PSP_O_CREAT, 0777);
sceIoWrite(fd, &config, sizeof(SampleConfiguration));
sceIoClose(fd);
}
*/
/*
void OnLoginFadeOutComplete(void *param)
{
// Destruct old items
vlfGuiCancelBottomDialog();
vlfGuiRemoveText(username_label);
vlfGuiRemoveText(password_label);
vlfGuiRemoveText(rp_label);
vlfGuiRemoveText(signin);
vlfGuiRemoveInputBox(username);
vlfGuiRemoveInputBox(password);
vlfGuiRemoveCheckBox(rp);
// Construct new items
VlfText done = vlfGuiAddText(240, 110, "Sign in successfull!\nConfiguration saved.");
vlfGuiSetTextAlignment(done, VLF_ALIGNMENT_CENTER);
vlfGuiCustomBottomDialog(NULL, "Exit", 1, 0, VLF_DEFAULT, OnExit);
vlfGuiSetRectangleFade(0, VLF_TITLEBAR_HEIGHT, 480, 272-VLF_TITLEBAR_HEIGHT, VLF_FADE_MODE_IN, VLF_FADE_SPEED_SUPER_FAST, 0, OnSaveConfig, param, 0);
}
*/
/*
int OnLoginScreenUp(void *param)
{
switch (focus)
{
case 1:
focus = 0;
vlfGuiSetInputBoxFocus(password, 0);
vlfGuiSetInputBoxFocus(username, 1);
break;
case 2:
focus = 1;
vlfGuiSetCheckBoxFocus(rp, 0);
vlfGuiSetInputBoxFocus(password, 1);
break;
case 3:
focus = 2;
vlfGuiRemoveTextFocus(signin, 1);
vlfGuiSetCheckBoxFocus(rp, 1);
break;
}
return VLF_EV_RET_NOTHING;
}
int OnLoginScreenDown(void *param)
{
switch (focus)
{
case 0:
focus = 1;
vlfGuiSetInputBoxFocus(username, 0);
vlfGuiSetInputBoxFocus(password, 1);
break;
case 1:
focus = 2;
vlfGuiSetInputBoxFocus(password, 0);
vlfGuiSetCheckBoxFocus(rp, 1);
break;
case 2:
focus = 3;
vlfGuiSetCheckBoxFocus(rp, 0);
vlfGuiSetTextFocus(signin);
break;
}
return VLF_EV_RET_NOTHING;
}
int OnLogin(int enter)
{
if (enter)
{
if (focus == 3)
{
vlfGuiGetInputBoxText(username, config.username);
if (config.username[0] == 0)
{
vlfGuiMessageDialog("Username is empty!", VLF_MD_TYPE_ERROR | VLF_MD_BUTTONS_NONE);
return VLF_EV_RET_NOTHING;
}
vlfGuiGetInputBoxText(password, config.password);
if (config.password[0] == 0)
{
vlfGuiMessageDialog("Password is empty!", VLF_MD_TYPE_ERROR | VLF_MD_BUTTONS_NONE);
return VLF_EV_RET_NOTHING;
}
vlfGuiRemoveEventHandler(OnLoginScreenUp);
vlfGuiRemoveEventHandler(OnLoginScreenDown);
vlfGuiSetRectangleFade(0, VLF_TITLEBAR_HEIGHT, 480, 272-VLF_TITLEBAR_HEIGHT, VLF_FADE_MODE_OUT, VLF_FADE_SPEED_SUPER_FAST, 0, OnLoginFadeOutComplete, (void *)vlfGuiIsCheckBoxChecked(rp), 0);
return VLF_EV_RET_REMOVE_HANDLERS;
}
}
else
{
sceKernelExitGame();
}
return VLF_EV_RET_NOTHING;
}
*/
void OnLicenseAgreementFadeOutComplete(void *param)
{
// Destruct old items
vlfGuiRemoveText(license);
vlfGuiRemoveText(do_you_agree);
vlfGuiCancelBottomDialog();
// Construct new items
//vlfGuiBottomDialog(VLF_DI_CANCEL, VLF_DI_ENTER, 1, 0, VLF_DEFAULT, OnLogin);
vlfGuiCustomBottomDialog(NULL, "Exit", 1, 0, VLF_DEFAULT, OnExit);
sceIoMkdir("sign", 0777);
sceIoChdir("sign");
sceIoRemove("EBOOT_signed.PBP");
sceIoRemove("param.sfo");
sceIoRemove("icon0.png");
sceIoRemove("icon1.pmf");
sceIoRemove("pic0.png");
sceIoRemove("pic1.png");
sceIoRemove("snd0.at3");
sceIoRemove("data.psp");
sceIoRemove("data_unsigned.psp");
sceIoRemove("data.psar");
// printf("Unpacking EBOOT file...\n");
// username = vlfGuiAddInputBox("Username", 64, 65);
// password = vlfGuiAddInputBox("Password", 64, 115);
// username_label = vlfGuiAddText(87, 45, "Username");
// password_label = vlfGuiAddText(87, 95, "Password");
// rp = vlfGuiAddCheckBox(70, 150);
crypter = vlfGuiAddText(64, 65, "Unpacking EBOOT file...\n");
// signin = vlfGuiAddText(240, 195, "Sign In");
err = main_unpack_pbp();
if(err != 0)
{
crypter = vlfGuiAddText(64, 120, "Error while unpacking: %d\n");
// myexit();
}
// vlfGuiSetTextFontSize(username_label, 0.75f);
// vlfGuiSetTextFontSize(password_label, 0.75f);
// vlfGuiSetTextAlignment(signin, VLF_ALIGNMENT_CENTER);
// vlfGuiSetInputBoxType(password, VLF_INPUTBOX_TYPE_PASSWORD);
// vlfGuiSetInputBoxTextW(username, config.username);
// vlfGuiSetInputBoxTextW(password, config.password);
/*
if (config.username[0] == 0)
{
vlfGuiSetInputBoxFocus(password, 0);
focus = 0;
}
else if (config.password[0] == 0)
{
vlfGuiSetInputBoxFocus(username, 0);
focus = 1;
}
else
{
vlfGuiSetInputBoxFocus(username, 0);
vlfGuiSetInputBoxFocus(password, 0);
vlfGuiSetCheckBoxCheck(rp, 1);
vlfGuiSetTextFocus(signin);
focus = 3;
}
vlfGuiAddEventHandler(PSP_CTRL_UP, 0, OnLoginScreenUp, NULL);
vlfGuiAddEventHandler(PSP_CTRL_DOWN, 0, OnLoginScreenDown, NULL);
*/
vlfGuiSetRectangleFade(0, VLF_TITLEBAR_HEIGHT, 480, 272-VLF_TITLEBAR_HEIGHT, VLF_FADE_MODE_IN, VLF_FADE_SPEED_SUPER_FAST, 0, NULL, NULL, 0);
}
int OnLicenseAgreement(int enter)
{
if (enter)
{
vlfGuiSetRectangleFade(0, VLF_TITLEBAR_HEIGHT, 480, 272-VLF_TITLEBAR_HEIGHT, VLF_FADE_MODE_OUT, VLF_FADE_SPEED_SUPER_FAST, 0, OnLicenseAgreementFadeOutComplete, NULL, 0);
return VLF_EV_RET_REMOVE_HANDLERS;
}
sceKernelExitGame();
return VLF_EV_RET_NOTHING;
}
void StartSample()
{
license = vlfGuiAddText(100, 40, license_text);
vlfGuiSetTextScrollBar(license, 90);
do_you_agree = vlfGuiAddText(120, 210, "Are you ready?");
vlfGuiBottomDialog(VLF_DI_CANCEL, VLF_DI_ENTER, 1, 0, VLF_DEFAULT, OnLicenseAgreement);
//vlfGuiCustomBottomDialog(NULL, "Exit", 1, 0, VLF_DEFAULT, OnLicenseAgreement);
vlfGuiSetRectangleFade(0, VLF_TITLEBAR_HEIGHT, 480, 272-VLF_TITLEBAR_HEIGHT, VLF_FADE_MODE_IN, VLF_FADE_SPEED_SUPER_FAST, 0, NULL, NULL, 0);
}
int menu_sel(int sel)
{
switch (sel)
{
case 0:
StartSample();
vlfGuiRemovePicture(logo);
return VLF_EV_RET_REMOVE_HANDLERS | VLF_EV_RET_REMOVE_OBJECTS;
case 1:
sceKernelExitGame();
case 2:
sceKernelExitGame();
break;
}
return VLF_EV_RET_NOTHING;
}
int app_main(int argc, char *argv[])
{
// pspDebugScreenInit();
char *items[] = { "Start Crypter", "Exit", "Exit2" };
vlfGuiSystemSetup(1, 1, 1);
vlfGuiLateralMenu(3, items, 0, menu_sel, 100);
logo = vlfGuiAddPictureFile("logo.png", 95, 80); // png's are now supported
// SceUID fd = sceIoOpen("config.bin", PSP_O_RDONLY, 0);
// if (fd >= 0)
// {
// sceIoRead(fd, &config, sizeof(SampleConfiguration));
// sceIoClose(fd);
// }
while (1)
{
vlfGuiDrawFrame();
}
return 0;
}