⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 anytmmain.c

📁 XFLASH source code for Sony Play Station Portable (PSP).
💻 C
📖 第 1 页 / 共 3 页
字号:
//					X-Flash Firmware Modification Program
//                     	               For the Sony Playstation Portable (PSP)
//                                   Firmware versions 1.50, 2.71 SE and 3.02 OE
//						    (c) Art 2006
//
//
#include <psppower.h>
#include <pspkernel.h>
#include <pspdebug.h>
#include <pspctrl.h>
#include <pspdisplay.h>
#include <xflash_files.h>
#include <openinga.h>
#include <openingb.h>
#include <wrench.h>
#include <credits.h>
#include <backgrounds.h>
#include <stars.h>
#include <se5click.h>
#include <se5org.h>
#include <blackboot.h>
#include <about.h>
#include <darkalex.h>
#include <artplate.h>
#include <basp.h>
#include <oasp.h>
#include <sefont.h>
#include <okvag.h>
#include <seblack.h>
#include <psprtc.h>
#include <psphprm.h>
#include <math.h>
#include <pspusb.h>
#include "mikmod.h"
#include <pspaudiolib.h>
#include "ram.h"
#include <ramsig.h>
#include "main.h"
#include "sndch.h"
#include "sndci.h"
#include "sndcr.h"
#include "sndfb.h"
#include "sndgr.h"
#include "sndgv.h"
#include "sndx.h"
#include "sndy.h"
#include "lpcm.h"
#include "pspidstor.h"

#define true 1
#define false 0

PSP_MODULE_INFO("X-FLASH", 0x1000, 1, 1);
PSP_MAIN_THREAD_ATTR(0);

#define printf	pspDebugScreenPrintf

pspTime rtime;

extern int _mm_errno;
extern BOOL _mm_critical;
extern char *_mm_errmsg[];

sample_t* loop_buffer;

u32 state;			// USB mode status variable
u32 freemem;			// free Memory Stick space Mb buffer
float flash_size;		// flash0 sum of file sizes
float mbflash_size;		// flash0 sum of file sizes
int editxmb = 0;		// xmb editor locked status
int nomenutm = 0;		// print menu with message status for topmenu copy
int dect = 0;			// set initial decrypted topmenu_plugin status
int coco;			// found country code status
int xgt;			// delay variable for coco print routine
int topmenu_size;		// topmenu_plugin size for checking routine
int ms_topmenu_size;		// memory stick topmenu_plugin size for checking routine
int calcsig = 0;		// calculate signature on screen status
int sigset;			// set ram signature
int bmperr = 0;			// bitmap error status from X-Flash V18/V18b Auto Restore bug
int fxvf;			//
int fxjan;			//
int fte;			//
int jak;			//
int stingoe = 0;		//
int dcnt;			//
int uhohfs = 0;			// extremely low flash space condition status
int blkk;			//
int mute = 0;			// sample player mute status
int vp;				// delay time
int turbo = 0;			// startup turbo mode
int samt;			//
int samr;			//
int startup = 0;		// startup sequence status for sound loop
int flashsi;			// integer for flash size
int bytesReadf = 1;		// counter for flash size routine
int mikModThreadID = -1;	//
int done = 0;			//
int restore = 0;		// auto restore status
int nodax = 0;			// no custom firmware status
int dodax = 0;			// auto install custom firmware status
int xexp = 0;			// fade circle expand counter
int mcntm;			// demo position memory
int mcrlx = 11;			// credits bar position memory
int mcrla = 16;			//
int mcrlb = 17;			//
int mcrlc = 18;			//
int irshell = 0;		// alternate nickname to allow irshell status indicator
int coinx = 63;			// free space powerup coin coordinate x
int coiny = 12;			// free space powerup coin coordinate y
int coinactive = 0;		// free space powerup coin active status
int fscoin = 0;			// free space power up collect sound control
int barpatch = 0;		// black slider bar patch status
int ooo;			// missing characters for TOP GUN! message
int ggg;			//
int nnn;			//
int lasertime;			// timer for special weapon
int eexplode = 0;		// free space enemy explosion status
int pexplode = 0;		// free space player explosion status
int cexplode = 0;		// free space explosion counter
int stretch;			// control for second special weapon firing line
int amiga;			// Amiga nickname Easter egg trigger status
int prelim;			// preliminary copy status
int checksum;			// checksum buffer for label file crypt routines
int labelsxffail = 0;		// status indicator for file checking routine
int counter;			// counter for label file crypt routines
int dcent = 34;			// demo circle centre
int dircent = 0;		// demo circle centre direction
int stari;			// function variable for starscreen
int fshiscore;			// free space high score buffer
int fsscore = 10800;		// set initial free space score
int fs_up = 0;			// free space up status for moving starscreen
int fs_down = 0;		// free space down status for moving starscreen
int fs_left = 0;		// free space left status for moving starscreen
int fs_right = 0;		// free space right status for moving starscreen
int delay;			// counter
int fsx = 8;			// set initial free space ship position x
int fsy = 17;			// set initial free space ship position y
int fbx = 8;			// set initial free space bullet position x
int fby = 17;			// set initial free space bullet position y
int fsfire = 0;			// set initial free space fire status
int fsalive = 1;		// set initial free space (enemy) alive status
int fsover = 0;			// set free space game over status
int fsshow = 0;			// set initial free space hidden status
int fsehit = 0;			// set initial enemy hit status for sound control
int fsphit = 0;			// set initial player hit status for sound control
int fsehitx = 0;		// set initial enemy destroyed status for sound control
int fshold;			// set message hold timer
int fshits = 0;			// set initial number of hits enemy ship has taken
int freespace;			// Free Space Easter Egg status
int sturm;			// nickname status for LordSturm
int xverx;			// temp version info rotate buffer
int labfileexists = 0;		// for checking existence of Labels.XF file
int labxfsize;			// for checking size of Labels.XF file
int themexfsize;		// for checking size of Theme.XF file
int disselect = 0;		// disable select button status
int disstart = 0;		// disable start button status
int dishome = 0;		// disable home button status
int lcol = 0;			// left column variable to allow slide in of menu
int memsig = 0x3F;		// set checksum seed for RAM signature
int sigcnt;			// memory pseudo array counter
int ram;			//
int ecdir = 0;			//
int eqrad = 1;			// eq radius variable
int wcxc = 0;			// windows effect control
int wc;				//
int xxtx;			//
int xxty;			//
int xxxy;			//
int xxtry;			//
int xo;				// line drawing variables
int yo;				//
int xi;				//
int yi;				//
int bcdir;			//
int art = 0;			// author identification variable
int mmc = 1;			// circle drawing control
int mmb = 1;			//
int mma = 1;			//
int mmd = 10;			//
int twidth;			// temp eq width buffer for rotation of pseudo array
int widtha;			// eq bar width buffers
int widthb;			//
int widthc;			//
int widthd;			//
int widthe;			//
int widthf;			//
int widthg;			//
int widthh;			//
int widthi;			//
int widthj;			//
int widthk;			//
int widthl;			//
int widthm;			//
int widthn;			//
int widtho;			//
int widthp;			//
int widthq;			//
int widthr;			//
int widths;			//
int widtht;			//
int widthu;			//
int widthv;			//
int widthw;			//
int widthx;			//
int n;				//
int fast = 0;			//
int t;				// buffer copy counter
int curspd = 0;			// character rotating speed variable
int colcur;			// cursor colour variable
int cursor = 0;			// editor cursor position
int editcnt = 0;		// editor screen position counteer
int fxt;			// counter for auto restore button delay
int saynos = 0;			// counter for flip finger easter egg
int config_count = 0;		//
int configmenu = 1;		// configurator menu position
int moda = 0;			// no kxploit mod status
int modb = 1;			// hide corrupt icons mod status
int modc = 0;			// skip coldbot intro screen mod status
int modd = 1;			// autoboot user program mod status
int memd;			//
int exitdarkalex = 0;		// don't apply the Dark_AleX mod twice
int exitdarkalexrev = 0;	// don't reverse the Dark_AleX mod twice
int there;			// existence of PSP/SYSTEM/config.txt status
int vshmainsize;		// file size check for vshmain.prx
int sysfolderexists = 0;	//
int dumpfolderexists = 0;	//
int registryfolderexists = 0;	//
int easter = 0;			// easter egg status
int firsttime = 0;		//
int aboutbuff;			// documentation file decrypt buffer
int aboutcnt = 0;		//
int resx = 0;			// background resolution buffers
int resy = 0;			//
int exlowbatt = 0;		// extremely low battery status
int agreement = 0x30;		// agreement status
int fms = 0;			// option 14 sideways status
int qpr = 0;			// option 15 sideways status
int dzm = 0;			// option 1 sideways status
int hilight;			//
int musac;			//
int file_size;			//
int sampls;			//
int stra = 100;			//
int strb = 100;			//
int strc = 100;			//
int strd = 100;			//
int stre = 100;			//
int strf = 100;			//
int strg = 100;			//
int strh = 100;			//
int stri = 100;			//
int strj = 100;			//
int strk = 100;			//
int strl = 100;			//
int strm = 100;			//
int strn = 100;			//
int stro = 100;			//
int starbb;			//
int starda = 10;		//
int stardb = 11;		//
int stardc = 12;		//
int stardd = 13;		//
int starde = 14;		//
int stardf = 15;		//
int stardg = 16;		//
int stardh = 17;		//
int stardi = 18;		//
int stardj = 19;		//
int stardk = 20;		//
int stardl = 21;		//
int stardm = 22;		//
int stardn = 23;		//
int stardo = 24;		//
int cr = 0;			//
int dia = 0xBC;			// diamond character
int alien = 15;			// star character
int greydir = 0;		//
int grey = 0x00666666;		//
int linecount;			//
int smiley = 0x01;		// smiley character 1
int bsmiley = 0x02;		// smiley character 2
int crbuff;			//
int stbuff;			//
int mcnt = 0;			//
int balla = 0;			//
int ballb = 0;			//
int ballx = 30;			//
int bally = 17;			//
int tballa = 0;			//
int tballb = 0;			//
int tballx = 57;		//
int tbally = 21;		//
int crly = 0;			//
int crlx = 11;			//
int crld = 0;			//
int crla = 16;			//
int crlb = 17;			//
int crlc = 18;			//
int tripcol;			//
int test = 0;			//
int ixt;			// delay counter
int fails = 0;			// number of verify fails. hopefully stays at zero
int color = 285887217;		//
int colorb = 285887217;		//
int colorc = 0x00333333;	// non selected menu colour
int colord = 0x00FFFFFF;	//
int colore = 0x00FFFFFF;	//
int disb;			//
int disq;			//
int errs = 1;			//
int colorda;			// dither effect colour buffers
int colordb;			//
int colordc;			//
int colordd;			//
int colorde;			//
int vfa;			// live verify display buffer
int vfb;			//
int vfc;			//
int vfd;			//
int vfe;			//
int vff;			//
int vfg;			//
int vfh;			//
int vfi;			//
int game = 1;			//
int gate;			//
int xxnt;			// wave function variable A
int fxx;			// wave function variable B
int nxx;			// file pointer for update icon function
int chkk;			//
int xxnu;			// counter for update icon function
int menu = 1;			//
int X = 1;			//
int exist = 0;			//
int C = 240;			//
int isplugged = 0;		// Is power cable plugged in? this variable contains the answer.
int batterypower = 0;		// battery power override
int isbatlow = 0;		//
int mlineb = 24;		// set up initial menu line positions
int mlinec = 10;		//
int mlined = 11;		//
int mlinee = 12;		//
int mlinef = 13;		//
int mlineg = 14;		//
int mlinea = 15;		//
int mlineo = 16;		//
int mlineh = 17;		//
int mlinei = 18;		//
int mlinej = 19;		//
int mlinek = 20;		//
int mlinel = 21;		//
int mlinem = 22;		//
int mlinen = 23;		//
int mlinet = 0;			// temporary menu buffer
int fetch;			// line position buffer for dither colour fetch
int esnt;			//
int fes;			//
int vmd;			//
int vmi;			//
int esno;			//
int feo;			//
int qmd;			//
int qmi;			//
int dfdx;			//
int jibber;			//
int gbtrx;			//
int notis = 0;			// not 1.50 firmware status variable
int nottt = 0;			// not 2.71 status variable
int notto = 0;			// not 3.02 status variable
int seb = 0;			// extra Dark_AleX 2.71 SE-B check
int oea = 0;			// Dark_AleX 3.02 OE check
int spreq = 16;			// space required for firmware dump
int sting = 0;			// not available in 2.71 message status flag
int ascii = 0;			// ascii Easter Egg nickname status
int cpa = 8;			// defines the position of characters of interest
int cpb = 9;			//
int cpc = 10;			//
int cpd = 11;			//
int fdo;			//
int month = 1;			//
int verify = 0;			//
int font_file_size;		//
int pmf_file_size;		//
int bmp_file_size;		//
int year;			// 
int started = 0;		// main program has started status for RAM routine
int vshbyte = 0;		// vshmain checking byte for 2.71 SE
int nickaddy = 0;		// nickname address flag
int rawdump = 0;		// raw dump status
int vbmpsize = 6176;		//
int rawdumpexists = 0;		// raw dump folder exists ststus
int openingsize;		// size of opening_plugin.rco file
int topmenusize;		// size of topmenu_plugin.rco file
int systemsize;			// size of system_plugin.rco file
int systembgsize;		// size of system_plugin_bg.rco file
int updatesize;			// size of update_plugin.rco file
int sysconfsize;		// size of sysconf_plugin.rco
int sam = 1;			// sample counter
int samlock = 0;		// player stopped
int samsel = 0;			// sample select
int n;				// sample player variable
char namebuffer[50];		//
char write_buffer[128*1024];	//
unsigned char data[133];	// version checking buffer
unsigned char datab[133];	// index.dat verify buffer
unsigned int buf[5];		// free memory display buffers
unsigned int *pbuf = buf;	//
unsigned char systv[94804];	// system_plugin.rco verify buffer
unsigned char systp[94804];	// system_plugin.rco buffer
unsigned char syscon[313628];	// sysconf_plugin.rco buffer
unsigned char vsys[313628];	// sysconf_plugin.rco verify buffer
unsigned char sysbg[10776];	// system_plugin_bg.rco buffer
unsigned char vbg[10776];	// system_plugin_bg.rco verify buffer
unsigned char update[49404];	// update_plugin.rco buffer
unsigned char vupd[49404];	// update_plugin.rco verify buffer
unsigned char back[25];		// background files buffer
unsigned char ltn0[10];		// ltn0.pgf font checking buffer
unsigned char gbram[200704];	// gameboot.pmf buffer
unsigned char bgbram[331776];	// black gameboot.pmf buffer
unsigned char fntram[2500000];	// ltn0.pgf (and external gameboot) buffer
unsigned char vfntram[2500000];	// ltn0.pgf (and external gameboot) verify buffer
unsigned char opening[266600];	// opening_plugin.rco / topmenu_plugin.rco buffer
unsigned char vopening[266600];	// opening_plugin.rco / topmenu_plugin.rco verify buffer
unsigned char settings[0xB5];	// user settings read from file
unsigned char coldboot[100880];	// coldboot.vag buffer (user supplied sound file)
unsigned char janram[6176];	//
unsigned char vjanram[74112];	//
unsigned char blankpmf[18];	//
unsigned char vblankpmf[18];	//
unsigned char dreg[11360];	// system.dreg buffer for parental control check
unsigned char vshreal[72032];	// real vshmain.prx buffer
unsigned char vvshreal[72032];	// real vshmain.prx verify buffer
unsigned char config[290];	// composed Dark_AleX configuration buffer
unsigned char ebuffer[260];	// menu editor buffer
unsigned char ebuffercomp[260];	// menu editor buffer
unsigned char ebufferxor[260];	// menu editor xor file encrypt table
unsigned char ver[25];		// X-Flash program version info buffer
unsigned char sver[25];		// star tunnel buffer
unsigned char nickname[25];	// nickname buffer
unsigned char allpics[74112];	// consolidated background files buffer
unsigned char sysctl[65454];	// systemctrl.prx buffer (3.02 OE version information)
unsigned char vsysctl[65454];	// systemctrl.prx verify buffer
char Region[512];		// primary Region key buffer
char Serial[512];		// primary Serial key buffer
char Country[512];		// primary Country key buffer
char Mac[512];			// primary MAC address buffer
char USBdes[512];		// primary USB desc buffer
u8 mac0;			// byte size elements for MAC address
u8 mac1;			//
u8 mac2;			//
u8 mac3;			//
u8 mac4;			//
u8 mac5;			//

void write_file(const char *readpath, const char *writepath);
void check(const char* zFile);
void find_sig(void);
void check_nick(void);
void check_music(void);
void boot_music(void);
void warn_flash(void);
void boot_security(void);
void warn_registry(void);
void print_menu(void);
void print_header(void);
void print_footer(void);
void print_blankfooter(void);
void print_credits(void);
void print_creditsb(void);
void crfooter(void);
void clear_midscreen(void);
void scroll_up (void);
void scroll_dn (void);
void read_to_ram(void);
void increment_vers(void);
void decrement_vers(void);
void print_message(void);
void print_regmessage(void);
void print_regrestore(void);
void verify_index(void);
void verify_sysconf(void);
void read_sysconf(void);
void en1337(void);
void de1337(void);
void read_dreg(void);
void read_sysbg(void);
void read_system(void);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -