Compare commits
2 Commits
Author | SHA1 | Date |
---|---|---|
Li | 3ae3f28fce | |
Li | a7d74dac2e |
|
@ -0,0 +1,44 @@
|
|||
TITLE_ID = ECDP00001
|
||||
TARGET = eCDPKeyGen
|
||||
OBJS = eCDP.o sound.o main.o menu.o draw.o bg.o logo.o box_unsel.o box_sel.o bgm.o se_back.o se_confirm.o se_type.o
|
||||
|
||||
LIBS = -lvita2d -lSceDisplay_stub -lSceGxm_stub \
|
||||
-lSceSysmodule_stub -lSceCtrl_stub -lScePgf_stub -lScePvf_stub \
|
||||
-lSceCommonDialog_stub -lfreetype -lpng -ljpeg -lz -lc -lSceAppMgr_stub \
|
||||
-lsoloud -lpthread -lSceAudio_stub -lstdc++ -lm
|
||||
|
||||
PREFIX = arm-vita-eabi
|
||||
CC = $(PREFIX)-gcc
|
||||
CXX = $(PREFIX)-g++
|
||||
CFLAGS = -Wl,-q -Wall -fno-lto
|
||||
CXXFLAGS = -Wl,-q -Wall -std=c++11
|
||||
ASFLAGS = $(CFLAGS)
|
||||
|
||||
all: $(TARGET).vpk
|
||||
|
||||
%.vpk: eboot.bin
|
||||
vita-mksfoex -s TITLE_ID=$(TITLE_ID) "$(TARGET)" param.sfo
|
||||
vita-pack-vpk -s param.sfo -b eboot.bin -a sce_sys/icon0.png=sce_sys/icon0.png -a sce_sys/pic0.png=sce_sys/pic0.png -a sce_sys/livearea/contents/bg.png=sce_sys/livearea/contents/bg.png -a sce_sys/livearea/contents/template.xml=sce_sys/livearea/contents/template.xml $@
|
||||
|
||||
eboot.bin: $(TARGET).velf
|
||||
vita-make-fself -s $< $@
|
||||
|
||||
%.velf: %.elf
|
||||
vita-elf-create $< $@
|
||||
|
||||
$(TARGET).elf: $(OBJS)
|
||||
$(CC) $(CFLAGS) $^ $(LIBS) -o $@
|
||||
%.o: %.cpp
|
||||
$(CXX) -c $(CXXFLAGS) $^ $(LIBS) -o $@
|
||||
|
||||
%.o: %.png
|
||||
$(PREFIX)-ld -r -b binary -o $@ $^
|
||||
|
||||
%.o: %.ogg
|
||||
$(PREFIX)-ld -r -b binary -o $@ $^
|
||||
|
||||
%.o: %.wav
|
||||
$(PREFIX)-ld -r -b binary -o $@ $^
|
||||
clean:
|
||||
@rm -rf $(TARGET).vpk $(TARGET).velf $(TARGET).elf $(OBJS) \
|
||||
eboot.bin param.sfo
|
After Width: | Height: | Size: 9.3 KiB |
After Width: | Height: | Size: 239 B |
After Width: | Height: | Size: 195 B |
|
@ -0,0 +1,138 @@
|
|||
#include "draw.h"
|
||||
#include <vita2d.h>
|
||||
#include <string.h>
|
||||
|
||||
const char* MAC_DEVIDER = ":";
|
||||
|
||||
vita2d_texture *bg;
|
||||
vita2d_texture *logo;
|
||||
|
||||
vita2d_texture *box_unsel;
|
||||
vita2d_texture *box_sel;
|
||||
|
||||
vita2d_pgf *pgf;
|
||||
vita2d_pvf *pvf;
|
||||
|
||||
void start_draw(){
|
||||
vita2d_start_drawing();
|
||||
vita2d_clear_screen();
|
||||
|
||||
vita2d_draw_texture(bg, 0, 0);
|
||||
vita2d_draw_texture(logo, (SCREEN_WIDTH/2) - (LOGO_WIDTH/2), 45);
|
||||
}
|
||||
|
||||
void end_draw(){
|
||||
vita2d_end_drawing();
|
||||
vita2d_swap_buffers();
|
||||
}
|
||||
|
||||
void finalize_draw(){
|
||||
vita2d_fini();
|
||||
vita2d_free_texture(bg);
|
||||
vita2d_free_texture(logo);
|
||||
vita2d_free_texture(box_unsel);
|
||||
vita2d_free_texture(box_sel);
|
||||
vita2d_free_pgf(pgf);
|
||||
vita2d_free_pvf(pvf);
|
||||
}
|
||||
void init_draw(){
|
||||
vita2d_init();
|
||||
vita2d_set_clear_color(RGBA8(0xFF, 0xFF, 0xFF, 0xFF));
|
||||
|
||||
pgf = vita2d_load_default_pgf();
|
||||
pvf = vita2d_load_default_pvf();
|
||||
|
||||
bg = vita2d_load_PNG_buffer(&_binary_bg_png_start);
|
||||
logo = vita2d_load_PNG_buffer(&_binary_logo_png_start);
|
||||
|
||||
box_unsel = vita2d_load_PNG_buffer(&_binary_box_unsel_png_start);
|
||||
box_sel = vita2d_load_PNG_buffer(&_binary_box_sel_png_start);
|
||||
|
||||
}
|
||||
void draw_text_center(int y, char* msg) {
|
||||
float size = 1.0f;
|
||||
int textWidth = 0;
|
||||
int textHeight = 0;
|
||||
vita2d_pgf_text_dimensions(pgf, size, msg, &textWidth, &textHeight);
|
||||
int textPos = (SCREEN_WIDTH/2) - (textWidth/2);
|
||||
vita2d_pgf_draw_text(pgf, textPos, y, COLOR_WHITE, size, msg);
|
||||
}
|
||||
|
||||
void draw_mac_picker(int y, char* octlets, int pos) {
|
||||
float size = 1.0f;
|
||||
|
||||
size_t totalOctlets = strlen(octlets);
|
||||
char octlet[2];
|
||||
memset(octlet, 0, sizeof(octlet));
|
||||
|
||||
int deviderWidth = 0;
|
||||
int deviderHeight = 0;
|
||||
vita2d_pgf_text_dimensions(pgf, size, MAC_DEVIDER, &deviderWidth, &deviderHeight);
|
||||
|
||||
int boxX = ((SCREEN_WIDTH/2) - (totalOctlets * (BOX_WIDTH + BOX_SPACING))/2);
|
||||
|
||||
for(int i = 0; i < totalOctlets; i++) {
|
||||
octlet[0] = octlets[i];
|
||||
int octletWidth = 0;
|
||||
int octletHeight = 0;
|
||||
|
||||
vita2d_pgf_text_dimensions(pgf, size, octlet, &octletWidth, &octletHeight);
|
||||
int octletPosX = boxX +((BOX_WIDTH/2) - (octletWidth/2));
|
||||
int octletPosY = y + ((BOX_HEIGHT - octletHeight) + (BOX_HEIGHT/2 - octletHeight/2));
|
||||
|
||||
if( i == pos ) {
|
||||
vita2d_draw_texture(box_sel, boxX, y);
|
||||
vita2d_pgf_draw_text(pgf, octletPosX, octletPosY, SELECTED_COLOR, size, octlet);
|
||||
}
|
||||
else {
|
||||
vita2d_draw_texture(box_unsel, boxX, y);
|
||||
vita2d_pgf_draw_text(pgf, octletPosX, octletPosY, UNSELECTED_COLOR, size, octlet);
|
||||
}
|
||||
|
||||
|
||||
if( ((i+1) % 2) == 0 && (i+1 < totalOctlets)) {
|
||||
boxX += (BOX_WIDTH + (BOX_SPACING/2));
|
||||
int deviderPosY = y + ((BOX_HEIGHT - deviderHeight) + (BOX_HEIGHT/2 - deviderHeight/2));
|
||||
vita2d_pgf_draw_text(pgf, boxX, deviderPosY, COLOR_WHITE, size, MAC_DEVIDER);
|
||||
boxX += deviderWidth + (BOX_SPACING/2);
|
||||
}
|
||||
else{
|
||||
boxX += (BOX_WIDTH + BOX_SPACING);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void draw_number_picker(int y, char* digits, int pos) {
|
||||
float size = 1.0f;
|
||||
|
||||
size_t totalDigits = strlen(digits);
|
||||
|
||||
|
||||
char digit[2];
|
||||
memset(digit, 0, sizeof(digit));
|
||||
|
||||
|
||||
int boxX = (SCREEN_WIDTH/2) - (totalDigits * (BOX_WIDTH + BOX_SPACING))/2;
|
||||
|
||||
for(int i = 0; i < totalDigits; i++) {
|
||||
digit[0] = digits[i];
|
||||
int digitWidth = 0;
|
||||
int digitHeight = 0;
|
||||
|
||||
vita2d_pgf_text_dimensions(pgf, size, digit, &digitWidth, &digitHeight);
|
||||
int digitPosX = boxX +((BOX_WIDTH/2) - (digitWidth/2));
|
||||
int digitPosY = y + ((BOX_HEIGHT - digitHeight) + (BOX_HEIGHT/2 - digitHeight/2));
|
||||
|
||||
if( i == pos ) {
|
||||
vita2d_draw_texture(box_sel, boxX, y);
|
||||
vita2d_pgf_draw_text(pgf, digitPosX, digitPosY, SELECTED_COLOR, size, digit);
|
||||
}
|
||||
else {
|
||||
vita2d_draw_texture(box_unsel, boxX, y);
|
||||
vita2d_pgf_draw_text(pgf, digitPosX, digitPosY, UNSELECTED_COLOR, size, digit);
|
||||
}
|
||||
|
||||
boxX += (BOX_WIDTH + BOX_SPACING);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
|
||||
#define SCREEN_WIDTH 960
|
||||
#define SCREEN_HEIGHT 544
|
||||
|
||||
#define LOGO_WIDTH 424
|
||||
#define LOGO_HEIGHT 160
|
||||
|
||||
#define BOX_HEIGHT 32
|
||||
#define BOX_WIDTH 32
|
||||
#define BOX_SPACING 8
|
||||
|
||||
#define COLOR_WHITE ( RGBA8(251,251,251,255) )
|
||||
#define COLOR_BLACK ( RGBA8(0,0,0,255) )
|
||||
|
||||
#define UNSELECTED_COLOR COLOR_WHITE
|
||||
#define SELECTED_COLOR COLOR_BLACK
|
||||
|
||||
extern unsigned char _binary_bg_png_start;
|
||||
extern unsigned char _binary_logo_png_start;
|
||||
|
||||
extern unsigned char _binary_box_unsel_png_start;
|
||||
extern unsigned char _binary_box_sel_png_start;
|
||||
|
||||
|
||||
void init_draw();
|
||||
void finalize_draw();
|
||||
|
||||
void start_draw();
|
||||
void end_draw();
|
||||
|
||||
void draw_text_center(int y, char* msg);
|
||||
void draw_number_picker(int y, char* digits, int pos);
|
||||
void draw_mac_picker(int y, char* octlets, int pos);
|
||||
|
|
@ -0,0 +1,203 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
char key[0xA8] = { 0x01,0x0A,0x16,0x04,0x07,0x18,0x0C,0x10,0x05,0x17,0x09,0x03,0x12,0x08,0x15,0x13,0x0B,0x02,0x0F,0x0D,0x11,0x0E,0x06,0x14,0x07,0x0C,0x0E,0x11,0x09,0x16,0x10,0x06,0x14,0x0D,0x01,0x02,0x12,0x08,0x13,0x0B,0x0F,0x0A,0x18,0x15,0x04,0x05,0x03,0x17,0x0F,0x04,0x09,0x03,0x06,0x07,0x11,0x12,0x15,0x16,0x02,0x08,0x05,0x17,0x0C,0x0D,0x01,0x18,0x0B,0x14,0x0E,0x10,0x13,0x0A,0x02,0x0A,0x0E,0x12,0x0B,0x03,0x0C,0x06,0x13,0x07,0x11,0x09,0x15,0x18,0x10,0x17,0x14,0x0F,0x04,0x01,0x05,0x08,0x16,0x0D,0x0B,0x02,0x09,0x16,0x14,0x01,0x12,0x11,0x15,0x06,0x0F,0x17,0x07,0x10,0x0C,0x0E,0x08,0x18,0x13,0x03,0x0A,0x0D,0x04,0x05,0x09,0x0F,0x05,0x0D,0x16,0x15,0x12,0x11,0x03,0x0A,0x04,0x10,0x0E,0x14,0x02,0x01,0x13,0x0C,0x06,0x0B,0x17,0x18,0x07,0x08,0x12,0x02,0x0C,0x09,0x0D,0x0E,0x04,0x07,0x16,0x14,0x17,0x01,0x11,0x03,0x10,0x15,0x08,0x0A,0x05,0x13,0x0B,0x18,0x0F,0x06 };
|
||||
char* hex_values = "0123456789ABCDEF";
|
||||
char* password_chars = "123456789ABCDEFGHJKLMNPQRSTUVWXYZ";
|
||||
unsigned short output_vals[6];
|
||||
|
||||
void substitute(char* input, char* output, int multiply_by)
|
||||
{
|
||||
char* keyChar;
|
||||
|
||||
keyChar = (char*)(multiply_by * 0x18 + (key));
|
||||
for(int i = 0; i < 0x18; i++) {
|
||||
output[i] = input[*keyChar + -1];
|
||||
keyChar ++;
|
||||
}
|
||||
output[0x18] = 0;
|
||||
}
|
||||
|
||||
int the_crazy_math_part(unsigned int val1, unsigned int val2, int carry, int start_at)
|
||||
{
|
||||
int c = carry;
|
||||
|
||||
long long r1 = 0xFFFFFFF9;
|
||||
long long r0 = val1;
|
||||
long long r3 = val2;
|
||||
|
||||
|
||||
// yes this is just the asm implemented in C, dont @ me
|
||||
|
||||
for (int i = start_at; i < 0x20; i++)
|
||||
{
|
||||
// adcs r3,r1,r3,lsl 1h
|
||||
r3 = (r1 + (r3 << 1)) + c; //same as r3 = (r3+(r1 * 2)) + c;
|
||||
c = (r3 >> 32); // set c flag
|
||||
r3 &= 0xFFFFFFFF;
|
||||
|
||||
// subcc r3,r3,r1
|
||||
if (!c)
|
||||
{
|
||||
r3 = (r3 - r1);
|
||||
r3 &= 0xFFFFFFFF;
|
||||
}
|
||||
|
||||
// adcs r0,r0,r0
|
||||
r0 = r0 + r0 + c; //Same as r0 = (r0 * 2) + c;
|
||||
c = (r0 >> 32); // set c flag
|
||||
r0 &= 0xFFFFFFFF;
|
||||
|
||||
}
|
||||
|
||||
return r3;
|
||||
}
|
||||
|
||||
|
||||
int find_multiplier(char* system_in)
|
||||
{
|
||||
int total_iterations = 0;
|
||||
int next_var = 0;
|
||||
|
||||
char* system_in_base_ptr = system_in;
|
||||
char* hex_values_ptr = hex_values;
|
||||
for (int i = 0; i < strlen(system_in_base_ptr); i++)
|
||||
{
|
||||
char c = *system_in++;
|
||||
char characters[2];
|
||||
memset(characters, 0, 2);
|
||||
characters[0] = c;
|
||||
|
||||
char* a2b = strstr(hex_values_ptr, characters);
|
||||
next_var = (uintptr_t)a2b - (uintptr_t)hex_values_ptr;
|
||||
if (!a2b)
|
||||
next_var = 0;
|
||||
total_iterations += next_var;
|
||||
}
|
||||
// step 2
|
||||
|
||||
unsigned int offset = 7;
|
||||
|
||||
if (offset <= total_iterations)
|
||||
{
|
||||
int c = 0;
|
||||
int start_at = 0x1c;
|
||||
unsigned int r3 = total_iterations >> 4;
|
||||
if (offset <= r3 >> 0xC)
|
||||
{
|
||||
start_at -= 0x10;
|
||||
r3 >>= 0x10;
|
||||
}
|
||||
if (offset <= r3 >> 0x10)
|
||||
{
|
||||
start_at -= 0x8;
|
||||
r3 >>= 0x8;
|
||||
}
|
||||
if (offset <= r3)
|
||||
{
|
||||
start_at -= 0x4;
|
||||
r3 >>= 0x4;
|
||||
}
|
||||
|
||||
unsigned int r0 = total_iterations << (start_at & 0xFF);
|
||||
|
||||
|
||||
c = ((long long int)r0 * 2) > 0xFFFFFFFF;
|
||||
r0 = r0 * 2;
|
||||
|
||||
printf("Starting Carry: %x\n", c);
|
||||
|
||||
|
||||
return the_crazy_math_part(r0, r3, c, start_at);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned int hex_to_bytes(char* input, int iterator)
|
||||
{
|
||||
char* iteration;
|
||||
char* final_char;
|
||||
int result;
|
||||
int i;
|
||||
char* current_char;
|
||||
char* enc = hex_values;
|
||||
result = 0;
|
||||
i = 0;
|
||||
current_char = input + iterator;
|
||||
int ii = 0xc;
|
||||
do {
|
||||
char curChar[2];
|
||||
memset(curChar, 0x00, 2);
|
||||
curChar[0] = current_char[0];
|
||||
|
||||
iteration = strstr(enc, curChar);
|
||||
final_char = iteration + -(intptr_t)enc;
|
||||
if (iteration == (char*)0x0) {
|
||||
final_char = (char*)0x0;
|
||||
}
|
||||
i = i + 1;
|
||||
result = result + ((uintptr_t)final_char << (ii & 0xff));
|
||||
ii = (ii - 4) & 0xffff;
|
||||
current_char = current_char + 1;
|
||||
} while (i < 4);
|
||||
return result & 0xffff;
|
||||
}
|
||||
|
||||
void generate_password(unsigned char* inbuf, char* output)
|
||||
{
|
||||
int i;
|
||||
i = 0;
|
||||
unsigned short* input = (unsigned short*) inbuf;
|
||||
do {
|
||||
output[i] = password_chars[input[i] - 1];
|
||||
i = i + 1;
|
||||
} while (i < 6);
|
||||
output[i] = '\0';
|
||||
return;
|
||||
}
|
||||
|
||||
int decode(char* encoded, char* outbuf){
|
||||
int iterator = 0;
|
||||
int i = 0;
|
||||
int ii = 0;
|
||||
|
||||
memset(outbuf, 0x00, 12);
|
||||
unsigned short* decoded = (unsigned short*) outbuf;
|
||||
do {
|
||||
int chr = hex_to_bytes(encoded, iterator);
|
||||
i = ii + 1;
|
||||
decoded[ii] = (unsigned short)chr;
|
||||
iterator = iterator + 4;
|
||||
ii = i;
|
||||
} while (i < 6);
|
||||
|
||||
i = 0;
|
||||
ii = 0;
|
||||
do
|
||||
{
|
||||
i = ii;
|
||||
int chr = decoded[ii++];
|
||||
decoded[i] = chr % 33 + 1;
|
||||
} while (ii < 6);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void ecdp_keygen(char* mac_address, char* maccas_id, char* mannager_id, char* output_key, size_t output_size) {
|
||||
char formatted[190];
|
||||
char encoded[64];
|
||||
char final_key[100];
|
||||
char decoded[12];
|
||||
|
||||
snprintf(formatted, sizeof(formatted), "%s%s%s", mac_address, maccas_id, mannager_id);
|
||||
int multiplier = find_multiplier(formatted);
|
||||
substitute(formatted, encoded, multiplier);
|
||||
decode(encoded, decoded);
|
||||
generate_password((unsigned char*)decoded, final_key);
|
||||
|
||||
strncpy(output_key, final_key, output_size);
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
// Written by Li
|
||||
#include <stddef.h>
|
||||
|
||||
void ecdp_keygen(char* mac_address, char* maccas_id, char* mannager_id, char* output_key, size_t output_size);
|
After Width: | Height: | Size: 39 KiB |
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* Written by Li (2022/28/NOV)
|
||||
* Trans Lefts.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <vitasdk.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "sound.h"
|
||||
#include "draw.h"
|
||||
#include "menu.h"
|
||||
|
||||
|
||||
int main() {
|
||||
time_t t;
|
||||
srand((unsigned int) time(&t));
|
||||
init_sound();
|
||||
init_draw();
|
||||
init_menus();
|
||||
|
||||
play_bgm();
|
||||
while (1) {
|
||||
start_draw();
|
||||
show_menu();
|
||||
end_draw();
|
||||
|
||||
process_menu();
|
||||
}
|
||||
|
||||
finalize_draw();
|
||||
finalize_sound();
|
||||
sceKernelExitProcess(0);
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,276 @@
|
|||
#include "menu.h"
|
||||
#include "draw.h"
|
||||
#include "eCDP.h"
|
||||
#include "sound.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <vitasdk.h>
|
||||
|
||||
static int pos = 0;
|
||||
static char StoreNo[64];
|
||||
static char SerialNo[64];
|
||||
static char MacAddress[64];
|
||||
static char OutputCode[64];
|
||||
static EcdpKeygenState state;
|
||||
|
||||
void randomize_octlets(char* octlets, size_t numbOctlets){
|
||||
for(int i = 0; i < numbOctlets; i++){
|
||||
int rng = (rand() % 0xF);
|
||||
|
||||
if(rng <= 9)
|
||||
octlets[i] = ('0' + rng);
|
||||
else
|
||||
octlets[i] = ('A' + rng-9);
|
||||
}
|
||||
octlets[numbOctlets+1] = 0;
|
||||
|
||||
}
|
||||
|
||||
void clear_data(char* digits, size_t numbDigits){
|
||||
memset(digits, '0', numbDigits);
|
||||
}
|
||||
|
||||
void randomize_digits(char* digits, size_t numbDigits){
|
||||
for(int i = 0; i < numbDigits; i++)
|
||||
digits[i] = ('0' + (rand() % 10));
|
||||
digits[numbDigits+1] = 0;
|
||||
|
||||
}
|
||||
|
||||
void wait_for_release(SceCtrlData oldPad){
|
||||
SceCtrlData curPad;
|
||||
memset(&curPad, 0, sizeof(curPad));
|
||||
sceCtrlPeekBufferPositive(0, &curPad, 1);
|
||||
do {
|
||||
sceCtrlPeekBufferPositive(0, &curPad, 1);
|
||||
|
||||
} while(curPad.buttons == oldPad.buttons);
|
||||
|
||||
}
|
||||
SceCtrlData get_buttons() {
|
||||
SceCtrlData pad;
|
||||
memset(&pad, 0, sizeof(pad));
|
||||
sceCtrlPeekBufferPositive(0, &pad, 1);
|
||||
if(pad.buttons != 0)
|
||||
wait_for_release(pad);
|
||||
return pad;
|
||||
}
|
||||
|
||||
void handle_mac_picker(char* octlets, EcdpKeygenState nextState){
|
||||
SceCtrlData pad = get_buttons();
|
||||
|
||||
size_t totalOctlets = strlen(octlets);
|
||||
|
||||
if(pos < 0) pos = 0;
|
||||
if(pos >= totalOctlets) pos = totalOctlets-1;
|
||||
|
||||
char octlet = octlets[pos];
|
||||
|
||||
switch(pad.buttons){
|
||||
case SCE_CTRL_UP:
|
||||
play_type_se();
|
||||
octlet++;
|
||||
break;
|
||||
case SCE_CTRL_DOWN:
|
||||
play_type_se();
|
||||
octlet--;
|
||||
break;
|
||||
case SCE_CTRL_LEFT:
|
||||
play_type_se();
|
||||
pos--;
|
||||
return;
|
||||
case SCE_CTRL_RIGHT:
|
||||
play_type_se();
|
||||
pos++;
|
||||
return;
|
||||
case SCE_CTRL_TRIANGLE:
|
||||
play_confirm_se();
|
||||
randomize_octlets(octlets, totalOctlets);
|
||||
return;
|
||||
case SCE_CTRL_CIRCLE:
|
||||
play_back_se();
|
||||
clear_data(octlets, totalOctlets);
|
||||
return;
|
||||
case SCE_CTRL_CROSS:
|
||||
play_confirm_se();
|
||||
state = nextState;
|
||||
pos = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if(octlet == '9' + 1) octlet = 'A';
|
||||
if(octlet == 'A' - 1) octlet = '9';
|
||||
if(octlet > 'F') octlet = '0';
|
||||
if(octlet < '0') octlet = 'F';
|
||||
|
||||
octlets[pos] = octlet;
|
||||
|
||||
}
|
||||
|
||||
void handle_number_picker(char* digits, EcdpKeygenState nextState){
|
||||
SceCtrlData pad = get_buttons();
|
||||
|
||||
size_t totalDigits = strlen(digits);
|
||||
|
||||
if(pos < 0) pos = 0;
|
||||
if(pos >= totalDigits) pos = totalDigits-1;
|
||||
|
||||
char digit = digits[pos];
|
||||
|
||||
|
||||
switch(pad.buttons){
|
||||
case SCE_CTRL_UP:
|
||||
play_type_se();
|
||||
digit++;
|
||||
break;
|
||||
case SCE_CTRL_DOWN:
|
||||
play_type_se();
|
||||
digit--;
|
||||
break;
|
||||
case SCE_CTRL_LEFT:
|
||||
play_type_se();
|
||||
pos--;
|
||||
return;
|
||||
case SCE_CTRL_RIGHT:
|
||||
play_type_se();
|
||||
pos++;
|
||||
return;
|
||||
case SCE_CTRL_TRIANGLE:
|
||||
play_confirm_se();
|
||||
randomize_digits(digits, totalDigits);
|
||||
return;
|
||||
case SCE_CTRL_CIRCLE:
|
||||
play_back_se();
|
||||
clear_data(digits, totalDigits);
|
||||
return;
|
||||
case SCE_CTRL_CROSS:
|
||||
play_confirm_se();
|
||||
state = nextState;
|
||||
pos = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(digit > '9') digit = '0';
|
||||
if(digit < '0') digit = '9';
|
||||
|
||||
digits[pos] = digit;
|
||||
|
||||
}
|
||||
|
||||
void init_menus(){
|
||||
pos = 0;
|
||||
memset(StoreNo, 0, sizeof(StoreNo));
|
||||
memset(SerialNo, 0, sizeof(SerialNo));
|
||||
memset(MacAddress, 0, sizeof(MacAddress));
|
||||
memset(OutputCode, 0, sizeof(OutputCode));
|
||||
|
||||
state = INPUT_MAC_ADDRESS;
|
||||
|
||||
clear_data(StoreNo, 6);
|
||||
clear_data(SerialNo, 6);
|
||||
clear_data(MacAddress, 12);
|
||||
}
|
||||
|
||||
void process_enter_mgr_no(){
|
||||
handle_number_picker(StoreNo, INPUT_SERIAL_NO);
|
||||
}
|
||||
|
||||
void process_enter_serial_no(){
|
||||
handle_number_picker(SerialNo, OUTPUT_CODE);
|
||||
|
||||
}
|
||||
|
||||
void process_enter_mac_address(){
|
||||
handle_mac_picker(MacAddress, INPUT_MGR_NO);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void process_output_code(){
|
||||
SceCtrlData pad = get_buttons();
|
||||
|
||||
switch(pad.buttons){
|
||||
case SCE_CTRL_CROSS:
|
||||
play_confirm_se();
|
||||
init_menus();
|
||||
break;
|
||||
case SCE_CTRL_CIRCLE:
|
||||
play_back_se();
|
||||
sceKernelDelayThread(260000);
|
||||
sceKernelExitProcess(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void draw_end(){
|
||||
draw_text_center(500, "× Generate Another / ○ Close Application");
|
||||
}
|
||||
|
||||
void draw_controls(){
|
||||
draw_text_center(500, "↑↓← → Change Input / △ Randomize Input / ○ Clear Input / × Confirm Input");
|
||||
}
|
||||
|
||||
void draw_enter_mgr_no(){
|
||||
draw_text_center(260, "Enter Store Number:");
|
||||
draw_number_picker(280, StoreNo, pos);
|
||||
draw_controls();
|
||||
}
|
||||
|
||||
void draw_enter_serial_no(){
|
||||
draw_text_center(260, "Enter Serial Number of DS Card:");
|
||||
draw_number_picker(280, SerialNo, pos);
|
||||
draw_controls();
|
||||
}
|
||||
|
||||
void draw_enter_mac_addr(){
|
||||
draw_text_center(260, "Enter DS Mac Address:");
|
||||
draw_mac_picker(280, MacAddress, pos);
|
||||
draw_controls();
|
||||
}
|
||||
|
||||
void draw_output_code(){
|
||||
draw_text_center(260, "Donald McDonald speaks with a cryptic message:");
|
||||
draw_number_picker(280, OutputCode, -1);
|
||||
draw_end();
|
||||
}
|
||||
|
||||
void show_menu(){
|
||||
switch(state){
|
||||
case INPUT_MGR_NO:
|
||||
draw_enter_mgr_no();
|
||||
break;
|
||||
case INPUT_SERIAL_NO:
|
||||
draw_enter_serial_no();
|
||||
break;
|
||||
case INPUT_MAC_ADDRESS:
|
||||
draw_enter_mac_addr();
|
||||
break;
|
||||
case OUTPUT_CODE:
|
||||
draw_output_code();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void process_menu() {
|
||||
switch(state){
|
||||
case INPUT_MGR_NO:
|
||||
process_enter_mgr_no();
|
||||
break;
|
||||
case INPUT_SERIAL_NO:
|
||||
process_enter_serial_no();
|
||||
break;
|
||||
case INPUT_MAC_ADDRESS:
|
||||
process_enter_mac_address();
|
||||
break;
|
||||
case OUTPUT_CODE:
|
||||
process_output_code();
|
||||
break;
|
||||
}
|
||||
|
||||
if(state == OUTPUT_CODE) {
|
||||
ecdp_keygen(MacAddress, StoreNo, SerialNo, OutputCode, sizeof(OutputCode));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
typedef enum {
|
||||
INPUT_MGR_NO,
|
||||
INPUT_SERIAL_NO,
|
||||
INPUT_MAC_ADDRESS,
|
||||
OUTPUT_CODE
|
||||
} EcdpKeygenState;
|
||||
|
||||
void init_menus();
|
||||
void show_menu();
|
||||
void process_menu();
|
After Width: | Height: | Size: 6.0 KiB |
After Width: | Height: | Size: 96 KiB |
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<livearea style="a1" format-ver="01.00" content-rev="1">
|
||||
<livearea-background>
|
||||
<image>bg.png</image>
|
||||
</livearea-background>
|
||||
</livearea>
|
After Width: | Height: | Size: 149 KiB |
|
@ -0,0 +1,54 @@
|
|||
#include <soloud.h>
|
||||
#include <soloud_wav.h>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cstddef>
|
||||
extern "C"
|
||||
{
|
||||
#include "sound.h"
|
||||
SoLoud::Soloud soloud;
|
||||
SoLoud::Wav bgm;
|
||||
|
||||
SoLoud::Wav se_type;
|
||||
SoLoud::Wav se_confirm;
|
||||
SoLoud::Wav se_back;
|
||||
|
||||
void init_sound() {
|
||||
soloud.init();
|
||||
soloud.setGlobalVolume(1.0);
|
||||
|
||||
// load sounds
|
||||
|
||||
size_t bgm_size = ((uintptr_t)&_binary_bgm_ogg_end - (uintptr_t)&_binary_bgm_ogg_start);
|
||||
bgm.loadMem(&_binary_bgm_ogg_start, bgm_size, false, false);
|
||||
bgm.setLooping(1);
|
||||
|
||||
size_t se_type_size = ((uintptr_t)&_binary_se_type_wav_end - (uintptr_t)&_binary_se_type_wav_start);
|
||||
se_type.loadMem(&_binary_se_type_wav_start, se_type_size, false, false);
|
||||
|
||||
size_t se_confirm_size = ((uintptr_t)&_binary_se_confirm_wav_end - (uintptr_t)&_binary_se_confirm_wav_start);
|
||||
se_confirm.loadMem(&_binary_se_confirm_wav_start, se_confirm_size, false, false);
|
||||
|
||||
size_t se_back_size = ((uintptr_t)&_binary_se_back_wav_end - (uintptr_t)&_binary_se_back_wav_start);
|
||||
se_back.loadMem(&_binary_se_back_wav_start, se_back_size, false, false);
|
||||
}
|
||||
void play_bgm() {
|
||||
soloud.play(bgm);
|
||||
}
|
||||
|
||||
void play_type_se() {
|
||||
soloud.play(se_type);
|
||||
}
|
||||
|
||||
void play_confirm_se() {
|
||||
soloud.play(se_confirm);
|
||||
}
|
||||
|
||||
void play_back_se() {
|
||||
soloud.play(se_back);
|
||||
}
|
||||
void finalize_sound() {
|
||||
soloud.deinit();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
|
||||
extern unsigned char _binary_bgm_ogg_start;
|
||||
extern unsigned char _binary_bgm_ogg_end;
|
||||
|
||||
extern unsigned char _binary_se_type_wav_start;
|
||||
extern unsigned char _binary_se_type_wav_end;
|
||||
|
||||
extern unsigned char _binary_se_confirm_wav_start;
|
||||
extern unsigned char _binary_se_confirm_wav_end;
|
||||
|
||||
extern unsigned char _binary_se_back_wav_start;
|
||||
extern unsigned char _binary_se_back_wav_end;
|
||||
|
||||
|
||||
void init_sound();
|
||||
void finalize_sound();
|
||||
void play_bgm();
|
||||
|
||||
void play_type_se();
|
||||
void play_confirm_se();
|
||||
void play_back_se();
|
Before Width: | Height: | Size: 154 B After Width: | Height: | Size: 154 B |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 111 KiB After Width: | Height: | Size: 111 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 111 KiB After Width: | Height: | Size: 111 KiB |