forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to make a config file?

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
angelo



Joined: 29 Aug 2007
Posts: 168

PostPosted: Sun Aug 10, 2008 12:07 am    Post subject: How to make a config file? Reply with quote

Hello, guys. I've coded this EBOOT launcher however I want to make a config file for it so the the can allocate it's target:

Here's my function and what I use to run it:

Code:
//Load_EBOOT Function
       
      void Load_EBOOT(char *target)
      {   
      struct SceKernelLoadExecVSHParam param;
      memset(&param, 0, sizeof(param));
      param.key = "game";
      param.size = sizeof(param);
      param.args = strlen(target)+1;
      param.argp = target;
      sctrlKernelLoadExecVSHMs2(target, &param);   
      }

//EBOOT 1
         
      if (isKeyPressed(KEY_1) && ctrl && alt){
      displayStatusText("Loading Application 1...");
      sceKernelDelayThread(3 * 1000 * 1000);
      Load_EBOOT("ms0:/SEPlugins/piKey/Applications/App1/EBOOT.PBP");
        }



I've come up with this so far:

Code:
int Application_1 = 0;
       
      // Read the config file
      int cfg = configOpen("ms0:/SEPlugins/piKey/AppLaunchConfig.txt");
      if (cfg >= 0)
      {
      while (configRead(cfg, cfgtoken, cfgvalue))
      {
      if (strcmp(cfgtoken, "Application 1") == 0)
      {
        Application_1 = (cfgvalue);
      }
         }
            }

       
      //EBOOT 1
         
      if (isKeyPressed(KEY_1) && ctrl && alt){
      displayStatusText("Loading Application 1...");
      sceKernelDelayThread(3 * 1000 * 1000);
      Load_EBOOT(Application_1);
        }



It gives the following errors:

Code:
ctrlout.c:515: warning: assignment makes integer from pointer without a cast
ctrlout.c:526: warning: passing argument 1 of 'Load_EBOOT' makes pointer from integer without a cast


I also have this in the config file:

Code:
Application 1 = "ms0:/SEPlugins/piKey/Applications/App1/EBOOT.PBP"


Any ideas please?

Anything is greatly appreciated!

Angelo
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Insert_witty_name



Joined: 10 May 2006
Posts: 376

PostPosted: Sun Aug 10, 2008 12:19 am    Post subject: Reply with quote

See moonlight's config code in his 1.5 cfw proof of concept.
Back to top
View user's profile Send private message
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Sun Aug 10, 2008 4:15 am    Post subject: Reply with quote

The compiler output is useless since we don't know what lines correspond to the numbers, nor have some of the functions they refer to.
Back to top
View user's profile Send private message AIM Address
angelo



Joined: 29 Aug 2007
Posts: 168

PostPosted: Sun Aug 10, 2008 4:44 am    Post subject: Reply with quote

Code:
int Application_1 = 0;
       
      // Read the config file
      int cfg = configOpen("ms0:/SEPlugins/piKey/AppLaunchConfig.txt");
      if (cfg >= 0)
      {
      while (configRead(cfg, cfgtoken, cfgvalue))
      {
      if (strcmp(cfgtoken, "Application 1") == 0)
      {
        Application_1 = (cfgvalue); //LINE AFFECTED
      }
         }
            }

       
      //EBOOT 1
         
      if (isKeyPressed(KEY_1) && ctrl && alt){
      displayStatusText("Loading Application 1...");
      sceKernelDelayThread(3 * 1000 * 1000);
      Load_EBOOT(Application_1);  //LINE AFFECTED
        }

After studying Dark_AleX's code, I still don't get it! Looks all very complex!

I need to do more researh and work so I get this!


Last edited by angelo on Sun Aug 10, 2008 5:54 am; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Raphael



Joined: 17 Jan 2006
Posts: 646
Location: Germany

PostPosted: Sun Aug 10, 2008 4:55 am    Post subject: Reply with quote

Quote:
int Application_1 = 0;

... this is supposed to be a char*, if anything at all.
_________________
<Don't push the river, it flows.>
http://wordpress.fx-world.org - my devblog
http://wiki.fx-world.org - VFPU documentation wiki

Alexander Berl
Back to top
View user's profile Send private message Visit poster's website
angelo



Joined: 29 Aug 2007
Posts: 168

PostPosted: Sun Aug 10, 2008 5:59 am    Post subject: Reply with quote

Ok... I tried that!

Code:
      // Read the config file
      int cfg = configOpen("ms0:/SEPlugins/piKey/AppLaunchConfig.txt");
      if (cfg >= 0)
      {
      while (configRead(cfg, cfgtoken, cfgvalue))
      {
      if (strcmp(cfgtoken, "Application 1") == 0)
      {
        Application_1 = (cfgvalue); //LINE AFFECTED
      }
         }
            }

       
      //EBOOT 1
         
      if (isKeyPressed(KEY_1) && ctrl && alt){
      displayStatusText("Loading Application 1...");
      sceKernelDelayThread(3 * 1000 * 1000);
      Load_EBOOT(Application_1);  //LINE AFFECTED
        }


This time, no errors when compiling, but now my PSP just freezes when I try a boot a game.

Here's the config file:

Code:
Application 1 = "ms0:/SEPlugins/piKey/Applications/App1/EBOOT.PBP"


I'm confused as to what's going wrong...
Back to top
View user's profile Send private message Send e-mail MSN Messenger
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Sun Aug 10, 2008 6:22 am    Post subject: Reply with quote

Are you closing the config file? Might not be your problem, but it's certainly something you should be doing.

Also, cfgvalue is a char array. Is (cfgvalue) a char*? I'd be using &cfgvalue there.
Back to top
View user's profile Send private message AIM Address
angelo



Joined: 29 Aug 2007
Posts: 168

PostPosted: Sun Aug 10, 2008 8:48 am    Post subject: Reply with quote

Smart thinking there J.F! Hey why don't you join the team?! XD Hehe!

I'll try it in the morning, it's nealry 12:00 am here and I'm typing on my Targus

Thanks guys! I'll let you all know how it goes!
Back to top
View user's profile Send private message Send e-mail MSN Messenger
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Sun Aug 10, 2008 9:41 am    Post subject: Reply with quote

angelo wrote:
Smart thinking there J.F! Hey why don't you join the team?! XD Hehe!


<Arnold Voice>You very funny guy - that why I kill you last.</Arnold Voice>
Back to top
View user's profile Send private message AIM Address
jean



Joined: 05 Jan 2008
Posts: 489

PostPosted: Sun Aug 10, 2008 10:37 am    Post subject: Reply with quote

..........
i can hear voices from the past screaming "no noob question here"....then all turns black. But it's all envy since i didn't get invited to "THE TEAM", too.....omg,wtf....
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group