• What are you working on? V2
    2,001 replies, posted
That's pretty awesome, quincy. I decided to pick up Java to create games, if that's a good thing. I'm doing basic stuff. Right now I'm learning on making a calculator. [editline]6:40[/editline] Done. [code]import java.util.Scanner; class apples{ public static void main(String args[]){ Scanner bucky = new Scanner(System.in); double fnum, snum, answer; System.out.println("Enter your first number: "); fnum = bucky.nextDouble(); System.out.println("Enter your second number: "); snum = bucky.nextDouble(); answer = fnum + snum; System.out.println("Your answer is: "); System.out.println(answer); } }[/code]
[QUOTE=Robber;17145363]How to get the home button to work. I'm new to writing for anything but Windows/Linux PCs and I'm not very experienced at C/C++. When I was writing that post I had trouble setting up the compiler and IDE, but that works now. I have some samples and one has the home button working, but I can not figure out why it is working there and not working in my program. When I'm somewhat familiar with it I want to use it to play/pause the WMP on my PC. So all I have to get working is the home button, the cross and WLAN (and sending something to my PC). Making the program on my PC get the commands from my PSP and control the WMP shouldn't be hard at all (at least I think so). If that would turn out to be a problem I could still use this: [url]http://msdn.microsoft.com/en-us/library/bb383953.aspx[/url] Wow, why the hell did I write such a lengthy post. :/[/QUOTE] I'm going to assume you've got the basic psp main file, but just in case I'll provide them here [cpp] #include <pspkernel.h> #include <pspdebug.h> PSP_MODULE_INFO("NAME OF YOUR GAME", 0, 1, 1); PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER); int ExitCallback(int Arg1, int Arg2, void* Common); int CallbackThread(SceSize Args, void* Argp); int SetupCallbacks(void); int main(int argc, char *argv[]) { pspDebugScreenInit(); SetupCallbacks(); for(;;) { } sceKernelExitGame(); return 0; } int ExitCallback(int Arg1, int Arg2, void* Common) { sceKernelExitGame(); return 0; } int CallbackThread(SceSize Args, void* Argp) { sceKernelRegisterExitCallback(sceKernelCreateCallback("Exit Callback", ExitCallback, NULL)); sceKernelSleepThreadCB(); return 0; } int SetupCallbacks(void) { int threadID = 0; threadID = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0); if (threadID >= 0) { sceKernelStartThread(threadID, 0, 0); } return threadID; } [/cpp] The exit callback, and other things, allow you to just hit the home button during the forever loop, and exit the program that way. If that doesn't work I guess I'll have to take a look at my project, but as far as I know, this basic main will let you hit home automatically :) good luck!
I don't know how that scheduler works, but shouldn't you be sleeping in the loop on line 16? It'll put a lot of unnecessary stress on the CPU.
[QUOTE=jA_cOp;17148098]I don't know how that scheduler works, but shouldn't you be sleeping in the loop on line 16? It'll put a lot of unnecessary stress on the CPU.[/QUOTE] The PSP uses a cooperative multi-tasker. Think DOS. You have one program running at any given time. With the PSP there are a few differences, namely when you git the home button you are sending a direct interrupt to the PSP OS(which is the actual "sleeping" program), which then pops up the ol' gui. Putting a sleep call in would just be slowing your game down (since you want as much of that delicious 333Mhz MIPS processor as you can get). Incidentally the CPU is by default in the PSP OS underclocked. Some games take advantage and push it back to the 333Mhz, but most don't, since the speeed doesn't cause damage to the PSP, it merely reduces Battery life. On an embedded platform like a handheld such as the DS/PSP/GP2X(Wiz), you cam really do only one thing at a time (i.e., Run a game, pictochat, take a picture, play music, etc.), so a sleep function wouldn't really help too much.
Finished off the mod stats page, now going to start working on the PHP backend [url]http://compwhizii.net/EventStats/new/benji.html[/url]
[QUOTE=compwhizii;17148931]Finished off the mod stats page, now going to start working on the PHP backend [url]http://compwhizii.net/EventStats/new/benji.html[/url][/QUOTE] Benji: Perma Bans: 27 Unbans: 27 Closes: 27 Opens: 27 Moves: 27 Renames: 27 DDTs: 27 Deletes: 27 Capfixes: 27 wat
[QUOTE=compwhizii;17148931]Finished off the mod stats page, now going to start working on the PHP backend [url]http://compwhizii.net/EventStats/new/benji.html[/url][/QUOTE] Nice use of Google Charts. :D
[QUOTE=Chandler;17148612]The PSP uses a cooperative multi-tasker. Think DOS. You have one program running at any given time.[/QUOTE] Cooperative time-sharing requires your program to voluntarily pass on the processor, so if that's the case for the PSP, you're doing it wrong. [QUOTE=Chandler;17148612]Putting a sleep call in would just be slowing your game down (since you want as much of that delicious 333Mhz MIPS processor as you can get).[/QUOTE] You don't always need the full power of the CPU, and when you don't, it's a waste to use it. This goes for any computer (PC processes hoarding an entire CPU core anyone?), but it's especially important on a handheld device, as to save power. [QUOTE=Chandler;17148612]On an embedded platform like a handheld such as the DS/PSP/GP2X(Wiz), you cam really do only one thing at a time (i.e., Run a game, pictochat, take a picture, play music, etc.), so a sleep function wouldn't really help too much.[/QUOTE] It does. If you don't put in a call to something that sleeps, you'll be using unnecessarily much CPU time, and use a lot more power than necessary. On the DS for example, there's a software interrupt that is run whenever the screen has finished drawing, which gives us the function swiWaitForVBlank that is customarily used in most (or all, in some programs) loops to reduce power consumption.
Oh, I guess I misunderstood the difference betwixt preemptive and cooperative multitasking. My mistake. PSP Homebrew has a function like that. it's something like VSyncWait. There are plenty of tutorials out there which show it's use at the end of your draw function, which is enough, I guess to not rape your battery at a constant speed.
[QUOTE=Catdaemon;17144921]The console is open when the game starts - That tilde bind doesn't actually work yet hurr. However, the commands there are being run from resource/game.cfg which contains: r_starfielddepth 500 bind w forward bind s backward bind a left bind d right bind tilde showconsole bind tab showchat[/QUOTE] Can I ask why everyone based their stuff on Source? Just because Source does the variables/commands/binds/etc. like that doesn't mean it's the best way to do it. [editline]11:58PM[/editline] [QUOTE=jA_cOp;17150231] You don't always need the full power of the CPU, and when you don't, it's a waste to use it. This goes for any computer (PC processes hoarding an entire CPU core anyone?), but it's especially important on a handheld device, as to save power. [/QUOTE] Tell me, what do you think Sleep() exactly does on an OS that runs 1 program at a time?
[QUOTE=nullsquared;17151339]Can I ask why everyone based their stuff on Source? Just because Source does the variables/commands/binds/etc. like that doesn't mean it's the best way to do it.[/QUOTE] Because it's simple and it works
[QUOTE=nullsquared;17151339]Can I ask why everyone based their stuff on Source? Just because Source does the variables/commands/binds/etc. like that doesn't mean it's the best way to do it. [/QUOTE] if it aint broke, don't fix it? I can't think of a better name for a console command to bind keys to actions. Edit I guess it's the reason you give functions names that slightly describe what they do. Source does a very good job at using one or two words to describe the console command (mp_autoteambalance, sv_lan, to name a few), and following that naming scheme will lead to having similar style as source.
[QUOTE=raccoon12;17149426]Benji: Perma Bans: 27 Unbans: 27 Closes: 27 Opens: 27 Moves: 27 Renames: 27 DDTs: 27 Deletes: 27 Capfixes: 27 wat[/QUOTE] It's a prototype.
[QUOTE=nullsquared;17151339]Can I ask why everyone based their stuff on Source? Just because Source does the variables/commands/binds/etc. like that doesn't mean it's the best way to do it.[/QUOTE] What would you suggest? Be constructive, not destructive with your criticism.
[QUOTE=nullsquared;17151339]Tell me, what do you think Sleep() exactly does on an OS that runs 1 program at a time?[/QUOTE] Tell me, what does this have to do with anything you quoted? (And his program is running two threads, in case you didn't notice)
[QUOTE=jA_cOp;17153274]Tell me, what does this have to do with anything you quoted? (And his program is running two threads, in case you didn't notice)[/QUOTE] actually all PSP programs start out in one thread. It's when you hit home that it creates a second. Threading Priority and whatnot. You can create more threads but it's all running on one single threaded core, so the PSP will choose the threadID with the highest priority and then run it, if the callback it given to it. Threading + PSP = total bitchtits. Honestly it's really unnecessary for the platform
[QUOTE=Chandler;17153625]actually all PSP programs start out in one thread. It's when you hit home that it creates a second. Threading Priority and whatnot. You can create more threads but it's all running on one single threaded core, so the PSP will choose the threadID with the highest priority and then run it, if the callback it given to it. Threading + PSP = total bitchtits. Honestly it's really unnecessary for the platform[/QUOTE] You are calling sceKernelCreateThread from your main thread...
[QUOTE=Chandler;17147676]I'm going to assume you've got the basic psp main file, but just in case I'll provide them here [cpp]//code [/cpp] The exit callback, and other things, allow you to just hit the home button during the forever loop, and exit the program that way. If that doesn't work I guess I'll have to take a look at my project, but as far as I know, this basic main will let you hit home automatically :) good luck![/QUOTE] Thanks, that should help me. :D
[QUOTE=jA_cOp;17153637]You are calling sceKernelCreateThread from your main thread...[/QUOTE] Yes. And? We're setting up callbacks to create the thread when the exit call back is sent. It gets put to sleep until home is pressed. You're not really going to do anything else with the thread except to interrupt the hardware so you can just plain exit the game right? So sleeping the main thread (Which is the ONLY thread being used by you), is useless, unless you don't mind seeing a windows program wth std::cout << "asdasd"; system("pause"); std::cout << "asdasd"; system("pause"); std::cout << "asdasd"; system("pause"); std::cout << "asdasd"; system("pause"); Because that's what using a sleep()-ish function would be like on the PSP while the game is playing. You have effectively a fixed time on the PSP for power, no matter the game. Samee with the DS. you can affect the DS by lowering the brightness of the screen, etc. but notice how the games aren't responsible for the DS's settings. When it comes to something like a portable gaming device, the manufacturer is usually the one who handles all that jazz.
I compiled your code and the home button works, but when I try to exit the game it just freezes saying "Please wait...". [B]Edit:[/B] It works now: [cpp]int main(int argc, char *argv[]) { pspDebugScreenInit(); SetupCallbacks(); SceCtrlData pad; int i=0; while(0==0) { i++; printf("test! %d\n",i); sceCtrlReadBufferPositive(&pad, 1); } sceKernelExitGame(); return 0; }[/cpp] Can someone explain why "sceCtrlReadBufferPositive(&pad, 1);" fixed it and what it does and why it's much slower now? I need a guide, doc, sample or anything on how to send packets via WLAN.
[QUOTE=nullsquared;17151339]Can I ask why everyone based their stuff on Source? Just because Source does the variables/commands/binds/etc. like that doesn't mean it's the best way to do it. [/QUOTE] I can't think of another game that does it better. Maybe you should have named a few.
[QUOTE=nullsquared;17151339]Can I ask why everyone based their stuff on Source? Just because Source does the variables/commands/binds/etc. like that doesn't mean it's the best way to do it.[/QUOTE] It doesn't, but it takes a lot of time out of the planning stage, so you can get straight to coding. Half of a big project is figuring out how it all comes together, if you already have a finished, working and thoroughly tested blueprint, that's one less thing to worry about. It's a lot easier to copy than to remake.
I wasn't talking about the naming. I'm talking about the whole console idea. Why must everything be console-based? "I want to move left." "Tell the console that." What? Why don't you skip the console and do something more direct and useful? You guys are following Source's example Just Because. I'm not saying it's completely bad, but I'm not saying there's anything amazing about it.
Because it allows you to edit the binds and commands easily without having to recompile, or make special interfaces for editing how data is handled.
The only bad thing about the source console is that it's very limited, like cmd.exe compared to bash.
[QUOTE=nullsquared;17151339]Can I ask why everyone based their stuff on Source? Just because Source does the variables/commands/binds/etc. like that doesn't mean it's the best way to do it.[/QUOTE] I actually agree, I try not to copy how other programs do things if I can help it. Look and behold at my stupid version system: VMajor Version.Release Number.Revision Number Major goes up when its rewritten or the source code is majorly changed Release goes up every release, at the moment its at 0 because it hasn't been released. Revision Number goes up when minor changes have been added. Then at the end you have: a = alpha b = beta r = release Meaning at the moment its at 1.0.2a, at release it will be 1.1.xr, every subsequent release 1.x.x (unless it gets re-written. So if you think about it really the development is at 0.2a, on release it will be 1.xr. The first part is only included after that major version becomes outdated. Then in marketing it will be called <Product> (Release Number) for example "Virtu-Planner 1" Yes, I spend way to much time thinking about things that don't really matter. My project folders are full of lists and diagrams because I can't stand not having everything documented.
[QUOTE=Robber;17153994]I need a guide, doc, sample or anything on how to send packets via WLAN.[/QUOTE] I think I've got it, except that I can't get it to connect to my WLAN.
[img]http://upload.namelezz.net/downloader.php?file=5192212_Swords.png[/img] [img]http://upload.namelezz.net/downloader.php?file=2679500_megaman.png[/img][img]http://upload.namelezz.net/downloader.php?file=907301_protomanconvert.png[/img] My go at an "image-mosaic" creator. It is written in C#. Many thanks to Maurice who helped me a lot. :)
Awesome SupahVee :) Working on my PHP forum [url]http://justdevs.com/[/url]
[QUOTE=nullsquared;17151339]Can I ask why everyone based their stuff on Source? Just because Source does the variables/commands/binds/etc. like that doesn't mean it's the best way to do it. [/QUOTE] Because I'm used to it and it works for me. How else do you want me to do it? XML? [QUOTE=nullsquared;17157477]I wasn't talking about the naming. I'm talking about the whole console idea. Why must everything be console-based? "I want to move left." "Tell the console that." What? Why don't you skip the console and do something more direct and useful? You guys are following Source's example Just Because. I'm not saying it's completely bad, but I'm not saying there's anything amazing about it.[/QUOTE] I don't use the console for movement. Bind is a command, +forward isn't. When you bind a key, it does this: [code] Select a[1] Case "forward" BKEY_FORWARD = keynum Case "backward" BKEY_BACKWARD = keynum Case "left" BKEY_LEFT = keynum Case "right" BKEY_RIGHT = keynum [/code] Which is generally nicer and is faster.
Sorry, you need to Log In to post a reply to this thread.