Results 1 to 2 of 2
  1. #1
    Kuro Tenshi's Avatar
    Join Date
    Jan 2009
    Gender
    male
    Location
    Where arth thou be
    Posts
    3,635
    Reputation
    70
    Thanks
    746
    My Mood
    Blah

    C++ PSP-InOutPutGAME to C# Console BAT

    i have made a lame-ass game a year ago when i was done with Industrial Programming in C, so i started in C++ since i knowz both and knew where to download these stuff ;D

    well first here is the C++ code

    [php]
    /*
    MiniTextGame 2 for the PSP by Ryan van den Bogaard
    */
    #include<pspkernel.h>
    #include<pspdebug.h>
    #include<pspdisplay.h>
    #include<pspctrl.h>
    #include <pspsdk.h>
    #include <string.h>
    PSP_MODULE_INFO("MiniTextGame C++", 0, 1, 1);

    #define printf pspDebugScreenPrintf

    int StartProgramma = 0;
    int whileEndProgram = 0;
    int whileStandbyProgram = 0;
    int test = 0;
    const char* Test;

    /*public:
    BadConversion(std::string const& s)
    : std::runtime_error(s)
    { }
    };*/

    inline char stringify(int x)
    {
    /*std:stringstream o;
    if (!(o << x))
    throw BadConversion("stringify(int)");
    return o.str();*/
    return x;
    }

    /* Exit callback */
    int exit_callback(int arg1, int arg2, void *common)
    {
    sceKernelExitGame();
    return 0;
    }

    /* Force Standby*/
    void sceSysconPowerStandby (void)
    {
    }

    /* Standby callback*/
    int standby_callback(int arg1, int arg2, void *common)
    {
    sceSysconPowerStandby();
    return 0;
    }

    /* Callback thread */
    int CallbackThread(SceSize args, void *argp)
    {
    int cbid;

    cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
    sceKernelRegisterExitCallback(cbid);

    sceKernelSleepThreadCB();

    return 0;
    }

    /* Sets up the callback thread and returns its thread id */
    int SetupCallbacks(void)
    {
    int thid = 0;

    thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0);
    if(thid >= 0)
    {
    sceKernelStartThread(thid, 0, 0);
    }

    return thid;
    }

    int main()
    {
    pspDebugScreenInit();
    SetupCallbacks();
    SceCtrlData pad;
    menu:
    pspDebugScreenClear();
    printf("Mini text game for the PSP\n\n\n\n");
    printf("Press Start to Start the game\n");
    printf("Press select to Exit the game\n");
    printf("Switch to hold to exit the GAME on \"Stand-By\"\n\n");
    printf(" WE'RE THREE CRACKERS IN SPACE\n");
    printf(" /\n");
    printf("___________________ _-_ /\n");
    printf("\==============_=_/ ____.---'---`---.____\n");
    printf(" \_ \ \----._________.----/\n");
    printf(" \ \ / / `-_-'\n");
    printf(" __,--`.`-'..'-_\n");
    printf(" /____ ||\n");
    printf(" `--.____,-'\n");
    StartProgramma = 1;

    //================================================== ================================================== ===========
    //========================================----Exit PROGRAMME @ START----========================================
    //================================================== ================================================== ===========
    while(StartProgramma == 1)
    {

    sceCtrlReadBufferPositive (&pad, 1);

    if (pad.Buttons & PSP_CTRL_SELECT)
    {
    pspDebugScreenClear();
    test = 500;
    whileEndProgram = 1;
    while(whileEndProgram == 1)
    {
    pspDebugScreenClear();
    printf("This program will end in: \n");
    printf("%d", test);
    if(test == 3)
    {
    break;
    }
    test-=1;
    sceKernelDelayThread(10000);//this is 0,01 seconds
    }
    sceKernelExitGame();
    }
    //================================================== ================================================== ===========
    //=======================================----STANDBY PROGRAMME @ START----=======================================
    //================================================== ================================================== ===========
    if (pad.Buttons & PSP_CTRL_HOLD)
    {
    pspDebugScreenClear();
    test = 3;
    whileStandbyProgram = 1;
    while(whileStandbyProgram == 1)
    {
    pspDebugScreenClear();
    printf("This program will exit in: \n");
    printf("%d", test);
    if (test >=2)
    {
    printf("\t Seconds");
    }
    else if(test <=1);
    {
    printf("\t Second");
    }

    if(test <= 0)
    {
    break;
    }
    test-=1;
    sceKernelDelayThread(1000000);
    }
    sceKernelExitGame();
    }

    //================================================== ================================================== ===========
    //=======================================---------START PROGRAMME---------=======================================
    //================================================== ================================================== ===========
    if (pad.Buttons & PSP_CTRL_START)
    {
    pspDebugScreenClear();
    printf("Hi and Welcome to the noobiest game eva, lets begin\n");
    printf("lets start of u are going to chose between 2 questions 2 times when u fail you have to start over but its not a problem just have fun\n\n");
    printf("You start in 10 seconds...");
    sceKernelDelayThread(10000000);
    pspDebugScreenClear();
    printf("A.SquareCross B.Cross C.Circle D.Triangle\n");
    printf("Where in europe is The UK?\n\n");
    printf("A: West-europe\n");
    printf("B: East-europe\n");
    printf("C: North-europe\n");
    printf("D: South-europe\n");
    }
    if (pad.Buttons & PSP_CTRL_CROSS)
    {
    pspDebugScreenClear();
    printf("YOU HAD IT WRONG,FAILURE\n");
    sceKernelDelayThread(5000000);
    pspDebugScreenClear();
    goto menu;
    }

    if (pad.Buttons & PSP_CTRL_TRIANGLE)
    {
    pspDebugScreenClear();
    printf("YOU HAD IT WRONG,FAILURE\n");
    sceKernelDelayThread(5000000);
    pspDebugScreenClear();
    goto menu;
    }

    if (pad.Buttons & PSP_CTRL_CIRCLE)
    {
    pspDebugScreenClear();
    printf("YOU HAD IT WRONG,FAILURE\n");
    sceKernelDelayThread(5000000);
    pspDebugScreenClear();
    goto menu;
    }


    if (pad.Buttons & PSP_CTRL_SQUARE)
    {
    pspDebugScreenClear();
    printf("You Were CORRECT\n");
    sceKernelDelayThread(5000000);
    pspDebugScreenClear();

    while(2)
    {
    pspDebugScreenClear();
    sceCtrlReadBufferPositive (&pad, 1);
    printf("A=Cross B=Square C=Circle D=Triangle\n");
    printf("Has this game any use?\n\n");
    printf("A: yes, it shows that C++ is possible on the PSP\n");
    printf("B: yes, its awesome\n");
    printf("C: no, not really it just basic coding\n");
    printf("D: why is this even a question, u should press this one for real\n");

    if (pad.Buttons & PSP_CTRL_CROSS)
    {
    pspDebugScreenClear();
    printf("YOU HAD IT WRONG,FAILURE\n");
    sceKernelDelayThread(5000000);
    pspDebugScreenClear();
    goto menu;
    }

    if (pad.Buttons & PSP_CTRL_CIRCLE)
    {
    pspDebugScreenClear();
    printf("YOU HAD IT WRONG,FAILURE\n");
    sceKernelDelayThread(5000000);
    pspDebugScreenClear();
    goto menu;
    }

    if (pad.Buttons & PSP_CTRL_TRIANGLE)
    {
    pspDebugScreenClear();
    printf("Succes you win the last questions is just to silly for words =D\n");
    sceKernelDelayThread(10000000);
    goto SceneAct1;
    //break;
    }

    if (pad.Buttons & PSP_CTRL_SQUARE)
    {
    pspDebugScreenClear();
    printf("YOU HAD IT WRONG,FAILURE\n");
    sceKernelDelayThread(5000000);
    pspDebugScreenClear();
    goto menu;
    }

    }


    }
    }


    sceKernelSleepThread();
    return 0;

    }
    [/php]

    here is the precisely the same code in C# though i left some parts out and changed the buttons of the console to the GetAsyncKeyState buttons from the keyboard for the pc also unnecessary code for C# was deleted the rest is defined in the void's below.

    [php]
    using System;
    using System.Windows.Forms;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Runtime.InteropServices;

    namespace ConsoleApplication2
    {
    class Program
    {
    [DllImport("user32.dll")]
    static extern short GetAsyncKeyState(System.Windows.Forms.Keys vKey);

    static int Main(string[] args)
    {
    int StartProgramma = 0;
    int whileEndProgram = 0;
    int whileStandbyProgram = 0;
    int value = 0;
    int test = 0;

    bool bullcrap = false;


    menu:
    pspDebugScreenClear();
    printf("Mini text game for the PSP ported to PC\n\n\n\n");
    printf("Press Return to Start the game\n");
    printf("Press ESC to Exit the game\n");
    printf("Switch to BackSpace to exit the GAME on \"Stand-By\"\n\n");
    printf(" WE'RE THREE CRACKERS IN SPACE\n");
    printf(" /\n");
    printf("___________________ _-_ /\n");
    printf("\\==============_=_/ ____.---'---`---.____\n");
    printf(" \\_ \\ \\----._________.----/\n");
    printf(" \\ \\ / / `-_-'\n");
    printf(" __,--`.`-'..'-_\n");
    printf(" /____ ||\n");
    printf(" `--.____,-'\n");
    StartProgramma = 1;

    //================================================== ================================================== ===========
    //========================================----Exit PROGRAMME @ START----========================================
    //================================================== ================================================== ===========
    while(StartProgramma == 1)
    {

    if (GetAsyncKeyState(Keys.Escape)<0)
    {
    pspDebugScreenClear();
    test = 500;
    whileEndProgram = 1;
    while(whileEndProgram == 1)
    {
    pspDebugScreenClear();
    printf("This program will end in: \n");
    printf("%d", test);
    if(test == 3)
    {
    break;
    }
    test-=1;
    sceKernelDelayThread(10000);//this is 0,01 seconds
    }
    sceKernelExitGame();
    }

    //================================================== ================================================== ===========
    //=======================================----STANDBY PROGRAMME @ START----=======================================
    //================================================== ================================================== ===========
    if (GetAsyncKeyState(Keys.Back)<0)
    {
    pspDebugScreenClear();
    test = 3;
    whileStandbyProgram = 1;
    while(whileStandbyProgram == 1)
    {
    pspDebugScreenClear();
    printf("This program will exit in: \n");
    printf("%d", test);
    if (test >=2)
    {
    printf("\t Seconds");
    }
    else if(test <=1);
    {
    printf("\t Second");
    }

    if(test <= 0)
    {
    break;
    }
    test-=1;
    sceKernelDelayThread(1000000);
    }
    sceKernelExitGame();
    }

    //================================================== ================================================== ===========
    //=======================================---------START PROGRAMME---------=======================================
    //================================================== ================================================== ===========
    if (GetAsyncKeyState(Keys.Return)<0)
    {
    pspDebugScreenClear();
    printf("Hi and Welcome to the noobiest game eva, lets begin\n");
    printf("lets start of u are going to chose between 2 questions 2 times when u fail you have to start over but its not a problem just have fun\n\n");
    printf("You start in 10 seconds...");
    sceKernelDelayThread(10000000);
    pspDebugScreenClear();
    printf("A.A-key B.S-key C.D-key D.W-key\n");
    printf("Where in europe is The UK?\n\n");
    printf("A: West-europe\n");
    printf("B: East-europe\n");
    printf("C: North-europe\n");
    printf("D: South-europe\n");
    }
    if (GetAsyncKeyState(Keys.W)<0)
    {
    pspDebugScreenClear();
    printf("YOU HAD IT WRONG,FAILURE\n");
    sceKernelDelayThread(5000000);
    pspDebugScreenClear();
    goto menu;
    }

    if (GetAsyncKeyState(Keys.S)<0)
    {
    pspDebugScreenClear();
    printf("YOU HAD IT WRONG,FAILURE\n");
    sceKernelDelayThread(5000000);
    pspDebugScreenClear();
    goto menu;
    }

    if (GetAsyncKeyState(Keys.D)<0)
    {
    pspDebugScreenClear();
    printf("YOU HAD IT WRONG,FAILURE\n");
    sceKernelDelayThread(5000000);
    pspDebugScreenClear();
    goto menu;
    }


    if (GetAsyncKeyState(Keys.A)<0)
    {
    pspDebugScreenClear();
    printf("You Were CORRECT\n");

    bullcrap = true;
    sceKernelDelayThread(5000000);
    pspDebugScreenClear();

    printf("A.A-key B.S-key C.D-key D.W-key\n");
    printf("Has this game any use?\n\n");
    printf("A: yes, it shows that C++ is possible on the PSP\n");
    printf("B: yes, its awesome\n");
    printf("C: no, not really it just basic coding\n");
    printf("D: why is this even a question, pick this one nooblet\n");
    while (bullcrap==true)
    {

    if (GetAsyncKeyState(Keys.D)<0)
    {
    pspDebugScreenClear();
    printf("YOU HAD IT WRONG,FAILURE\n");
    sceKernelDelayThread(5000000);
    pspDebugScreenClear();
    goto menu;
    }

    if (GetAsyncKeyState(Keys.A)<0)
    {
    pspDebugScreenClear();
    printf("YOU HAD IT WRONG,FAILURE\n");
    sceKernelDelayThread(5000000);
    pspDebugScreenClear();
    goto menu;
    }

    if (GetAsyncKeyState(Keys.W)<0)
    {
    pspDebugScreenClear();
    printf("MEH...\n");
    sceKernelDelayThread(3000000);
    goto menu;
    }

    if (GetAsyncKeyState(Keys.S)<0)
    {
    pspDebugScreenClear();
    printf("YOU HAD IT WRONG,FAILURE\n");
    sceKernelDelayThread(5000000);
    pspDebugScreenClear();
    goto menu;
    }
    }


    }
    }

    return 0;


    }

    private static void sceKernelExitGame()
    {
    Application.Exit();
    printf("Press any Key to exit the game.");
    Console.ReadKey();
    }

    private static void printf(string p, int test)
    {
    Console.Write(p+"{0}",test);
    }

    private static void sceKernelDelayThread(int p)
    {
    System.Threading.Thread.Sleep(p/1000);
    }

    private static void printf(string p)
    {
    Console.Write(p);
    }

    private static void pspDebugScreenClear()
    {
    Console.Clear();
    }
    }
    }

    [/php]

    ;D quite nice noh this might be handy for learning to code PSPgames if u dont have a psp/dont want to keep switching between console and pc... also if u code the top one with a program named PSPDEV and compile it with CMD with the makefile (BELOW) u can test it on your psp customfirmed ofcourse or you can test it on THIS emulator its java scripted and it works excelent also with roms and such but yeah its legal to test homebrew with this, ALSO PLEASE LOOK AT THIS:


    No Gravity Homebrew (i have played it 3-4 years ago on my brothers 1.50 psp and on my 2.71(m33 previous version name i cant remember)by DARK ALEX)
    [media]https://www.youtube.com/watch?v=ECueezYVn-8[/media]


    This game has been developed by a homebrew game creator for the psp, the creator now has been assigned @ sony and has made an Original SONY game so yeah it could make you famous if your good ;D

    No Gravity: The Plague of the Mind OFFICIAL TRAILER #1 (havent played it, came out this year )
    [media]https://www.youtube.com/watch?v=SPx9zikiOu8[/media]


    Addon:

    # Makefile:
    Code:
    TARGET=MiniTextGame
    OBJS=main.o
    
    CFLAGS = -O2 -G0 -Wall
    CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
    ASFLAGS = $(CFLAGS)
    
    EXTRA_TARGETS = EBOOT.PBP
    PSP_EBOOT_TITLE = AAAAAA
    PSP_EBOOT_ICON = ICON0.png
    
    PSPSDK=$(shell psp-config --pspsdk-path)
    include $(PSPSDK)/lib/build.mak
    ADD this to the folder too its the EBOOT_ICON:


    u can change dimesions or text but this one certainly works also change PSP_EBOOT_TITLE = PUT IN NAME WHAT U WANT (try not to use Spaces... might get corrupt.)

    /mainly i used this as a tutorial on another site... for anti hacking :3 u can find it when you copy past most of the codes on google. /yea hur hur.mpgh ftw.
    DigiDrawing|+ ( (Elfen Archer) )
    Link:
    https://www.mpgh.net/forum/148-showro...en-archer.html


    @ Anime Section,Otaku/weeabo (orz.) @Graphics Section, Novice DigiArtist


    neuest gift from Yura~Chan:
    https://bakyurayuu.deviantar*****m/#/d372taw
    2nd Place MOTM#9 Theme: CharMods - Combat Arms [No - Thanks] button
    come on you know that don't want to push that ordinary button

  2. #2
    Stephen's Avatar
    Join Date
    Jun 2009
    Gender
    male
    Location
    Engine.exe
    Posts
    4,689
    Reputation
    184
    Thanks
    1,149
    My Mood
    Aggressive
    Epic .

    Console's are great. /

Similar Threads

  1. Psp Hackers?
    By X100C001 in forum General Game Hacking
    Replies: 1
    Last Post: 08-15-2007, 05:20 AM
  2. PSP Backgrounds
    By Jackal in forum Art & Graphic Design
    Replies: 8
    Last Post: 02-12-2007, 05:09 AM
  3. Console Wars
    By arunforce in forum Entertainment
    Replies: 9
    Last Post: 07-02-2006, 11:09 PM
  4. Just in case you use the Console Administrator Hack...
    By Rocker1989 in forum Gunz General
    Replies: 9
    Last Post: 05-26-2006, 09:05 AM
  5. .:PSP games/reviews:.
    By darkone1149 in forum General
    Replies: 21
    Last Post: 04-03-2006, 07:02 PM