Quake3World.com Forums
     Programming Discussion
        how disable cd key check?


Post new topicReply to topic
Login | Profile | | FAQ | Search | IRC




Print view Previous topic | Next topic 
Topic Starter Topic: how disable cd key check?

Trainee
Trainee
Joined: 04 Apr 2008
Posts: 26
PostPosted: 03-11-2009 12:23 PM           Profile Send private message  E-mail  Edit post Reply with quote


Each time when i start my Ioquake3 he askes for the CD Key how can I disable this where it is in the code anybode knows?
Otherwise how can i add .cfg in the console /exec example.cfg but where in the code I can do this that he made this example.cfg as a default?

Thank you




Top
                 

Trainee
Trainee
Joined: 01 Mar 2009
Posts: 44
PostPosted: 03-11-2009 02:30 PM           Profile Send private message  E-mail  Edit post Reply with quote


it is not legal
also you dont need to enter anything




Top
                 

Trainee
Trainee
Joined: 04 Apr 2008
Posts: 26
PostPosted: 03-11-2009 04:10 PM           Profile Send private message  E-mail  Edit post Reply with quote


hmm sure?
Because the Standalone games ala urbanterror that based on ioquake3 doesnt have the cd key check anymore

and what is with my other question any ideas?




Top
                 

Trainee
Trainee
Joined: 01 Mar 2009
Posts: 44
PostPosted: 03-11-2009 04:20 PM           Profile Send private message  E-mail  Edit post Reply with quote


standalone games are not quake3
quake3 is a commercial game, ioquake3 didn't removed the check because it works with quake3 media
assuming you are working on a standalone game take look at this...
http://openarena.ws/svn/source/oachanges.diff




Top
                 

Immortal
Immortal
Joined: 12 Mar 2005
Posts: 2205
PostPosted: 03-11-2009 07:04 PM           Profile   Send private message  E-mail  Edit post Reply with quote


but OpenArena merely replaces the Quake 3 media with GPL friendly media. It runs on IOQuake3 irrc...

Also, the code is open source now. I don't see any problems with disabling the cd key check regardless if the executable can read and use the vanilla Q3 media.

In any case, this is how I disabled the cdkey check since I couldn't get anything to run even if I entered nothing for the cdkey.

in ui_main.c, take a peek at UI_SetActiveMenu(uiMenuCommand_t menu)...

I simply commented out the checks for a cd key.

See if you can spot the checks and try commenting them out yourself :) I had my version of the function posted but I edited this post because merely copying/pasting code doesn't teach you anything.

Good luck!




Top
                 

Warrior
Warrior
Joined: 16 May 2006
Posts: 90
PostPosted: 04-02-2009 01:34 AM           Profile Send private message  E-mail  Edit post Reply with quote


I commented out everything that looks as if it could have something to do with the cdkey, but without success :cry: (oh, in "normal" q3, not ioquake). I'm not a coder and guess I'll never become one. Just would like to make that stupid keycheck disappear from my mod... Could you pm me the altered code?! Don't want to ruin the learning experience for others of course! ;)



_________________
Visit MONKEYS of DOOM at http://www.monkeysofdoom.org


Top
                 

Señor Shambler
Señor Shambler
Joined: 07 Mar 2006
Posts: 849
PostPosted: 04-02-2009 04:55 AM           Profile Send private message  E-mail  Edit post Reply with quote


Silicone_Milk wrote:
but OpenArena merely replaces the Quake 3 media with GPL friendly media. It runs on IOQuake3 irrc...


OA does have ui/engine code changes, it doesn't ask for a cd key...




Top
                 

Mentor
Mentor
Joined: 12 Mar 2005
Posts: 3958
PostPosted: 04-02-2009 05:08 AM           Profile Send private message  E-mail  Edit post Reply with quote


Yep, it branched from ioquake3 nearly two years ago (rev 1106, I think).




Top
                 

Warrior
Warrior
Joined: 16 May 2006
Posts: 90
PostPosted: 04-02-2009 05:48 AM           Profile Send private message  E-mail  Edit post Reply with quote


I need this for Symbian OS Q3, which is based on the id version of the source. But I'm gonna have a look at the code from oa. Maybe ui_main.c doesn't differ too much...



_________________
Visit MONKEYS of DOOM at http://www.monkeysofdoom.org


Top
                 

Mentor
Mentor
Joined: 12 Mar 2005
Posts: 3958
PostPosted: 04-02-2009 06:40 AM           Profile Send private message  E-mail  Edit post Reply with quote


UI_MainMenu() in q3_ui/ui_menu.c. Remove this bit:
Code:
    if( !uis.demoversion && !ui_cdkeychecked.integer ) {
        char    key[17];

        trap_GetCDKey( key, sizeof(key) );
        if( trap_VerifyCDKey( key, NULL ) == qfalse ) {
            UI_CDKeyMenu();
            return;
        }
    }




Top
                 

Warrior
Warrior
Joined: 16 May 2006
Posts: 90
PostPosted: 04-02-2009 10:26 PM           Profile Send private message  E-mail  Edit post Reply with quote


Great, works! Thanks a lot once again! :)



_________________
Visit MONKEYS of DOOM at http://www.monkeysofdoom.org


Top
                 

Immortal
Immortal
Joined: 12 Mar 2005
Posts: 2205
PostPosted: 04-02-2009 10:41 PM           Profile   Send private message  E-mail  Edit post Reply with quote


Interesting. I hadn't touched UI_MainMenu but still managed to disable the cd key check.

Hmm... I probably ended up breaking something rather than disabling the check -_-




Top
                 

Warrior
Warrior
Joined: 16 May 2006
Posts: 90
PostPosted: 04-03-2009 01:47 AM           Profile Send private message  E-mail  Edit post Reply with quote


PS:
I think it isn't worth opening a new thread for this cause it might not be interesting for anyone but me: How do I disable (skip) the "confirm" window, too?

Code:
/*
=================
ConfirmMenu_Event
=================
*/
static void ConfirmMenu_Event( void* ptr, int event ) {
   qboolean   result;

   if( event != QM_ACTIVATED ) {
      return;
   }

   UI_PopMenu();

   if( ((menucommon_s*)ptr)->id == ID_CONFIRM_NO ) {
      result = qfalse;
   }
   else {
      result = qtrue;
   }

   if( s_confirm.action ) {
      s_confirm.action( result );
   }
}


Can I just set "qboolean" to "qtrue" and comment out the rest?

(I know, I know... I'm asking a whole lot of questions theese days) :rolleyes:



_________________
Visit MONKEYS of DOOM at http://www.monkeysofdoom.org


Top
                 

Warrior
Warrior
Joined: 16 May 2006
Posts: 90
PostPosted: 04-03-2009 01:53 AM           Profile Send private message  E-mail  Edit post Reply with quote


Hm... No, doesn't work that way.



_________________
Visit MONKEYS of DOOM at http://www.monkeysofdoom.org


Top
                 

Trainee
Trainee
Joined: 01 Mar 2009
Posts: 44
PostPosted: 04-03-2009 09:27 AM           Profile Send private message  E-mail  Edit post Reply with quote


"qboolean" is the type of "result"
qtrue and qfalse are possible values for "result". they are not types :)




Top
                 

Señor Shambler
Señor Shambler
Joined: 07 Mar 2006
Posts: 849
PostPosted: 04-03-2009 10:26 AM           Profile Send private message  E-mail  Edit post Reply with quote


In the main menu code, ui_menu.c, each of the buttons you can press are giving unique identification numbers, #define'd up at the very top. Whenever the user clicks on a button, the mouse/key handling code routes the button to the "callback" function, where an appropriate decision about what to do is made based upon the ID.

Since you know that clicking the exit button is what triggers the confirmation menu, then look for where the button is defined:

Code:
   s_main.exit.generic.type                = MTYPE_PTEXT;
    s_main.exit.generic.flags               = QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
    s_main.exit.generic.x                   = 320;
    s_main.exit.generic.y                   = y;
    s_main.exit.generic.id                  = ID_EXIT;
    s_main.exit.generic.callback            = Main_MenuEvent;
    s_main.exit.string                      = "EXIT";
    s_main.exit.color                       = color_red;
    s_main.exit.style                       = style;


You can see that the id is set to ID_EXIT, and the callback is Main_MenuEvent. So have a gander there to see what happens:

Code:
/*
=================
Main_MenuEvent
=================
*/
void Main_MenuEvent (void* ptr, int event) {
    if( event != QM_ACTIVATED ) {
        return;
    }

    switch( ((menucommon_s*)ptr)->id ) {
    case ID_SINGLEPLAYER:
        UI_SPLevelMenu();
        break;

    case ID_MULTIPLAYER:
        UI_ArenaServersMenu();
        break;

    case ID_SETUP:
        UI_SetupMenu();
        break;

    case ID_DEMOS:
        UI_DemosMenu();
        break;

    case ID_CINEMATICS:
        UI_CinematicsMenu();
        break;

    case ID_MODS:
        UI_ModsMenu();
        break;

    case ID_TEAMARENA:
        trap_Cvar_Set( "fs_game", "missionpack");
        trap_Cmd_ExecuteText( EXEC_APPEND, "vid_restart;" );
        break;

    case ID_EXIT:
        UI_ConfirmMenu( "EXIT GAME?", 0, MainMenu_ExitAction );
        break;
    }
}


This is where you want to be working. If you want it to just exit, then you need to investigate UI_ConfirmMenu() further to find out what is done when the user presses "yes", and then copy that up to this level and remove the call to UI_ConfirmMenu().

If I were you I'd pick up The C Programming Language; reading just the first couple of chapters will help you out immensely, and even if you don't want to sit down and learn the language, you can use it as a reference to look things up and figure out what code is doing. It's like < 200 pages IIRC and very concise.




Top
                 

Warrior
Warrior
Joined: 16 May 2006
Posts: 90
PostPosted: 04-04-2009 12:53 AM           Profile Send private message  E-mail  Edit post Reply with quote


Thanks for the detailed explanation! :) I had a closer look at ConfirmMenu_Event, but what I found there doesn't seem to fit within Main_MenuEvent...

Code:
/*
=================
ConfirmMenu_Event
=================
*/
static void ConfirmMenu_Event( void* ptr, int event ) {
   qboolean   result;

   if( event != QM_ACTIVATED ) {
      return;
   }

   UI_PopMenu();

   if( ((menucommon_s*)ptr)->id == ID_CONFIRM_NO ) {
      result = qfalse;
   }
   else {
      result = qtrue;
   }

   if( s_confirm.action ) {
      s_confirm.action( result );
   }
}


Don't understand what happens when the player hits "Yes", only that it's not the same as when he hits "No"... :question:

Oh, and I would like to get completely rid of that "Confirm" dialog! (Appears in some other occasions, too...)



_________________
Visit MONKEYS of DOOM at http://www.monkeysofdoom.org


Top
                 

Mentor
Mentor
Joined: 12 Mar 2005
Posts: 3958
PostPosted: 04-04-2009 02:52 AM           Profile Send private message  E-mail  Edit post Reply with quote


You want every confirmation menu to not display and act like the user clicked 'Yes'? Or only one or two specific instances?




Top
                 

Warrior
Warrior
Joined: 16 May 2006
Posts: 90
PostPosted: 04-05-2009 12:13 AM           Profile Send private message  E-mail  Edit post Reply with quote


^misantropia^ wrote:
You want every confirmation menu to not display and act like the user clicked 'Yes'?

Exactly!



_________________
Visit MONKEYS of DOOM at http://www.monkeysofdoom.org


Top
                 

Mentor
Mentor
Joined: 12 Mar 2005
Posts: 3958
PostPosted: 04-06-2009 01:42 AM           Profile Send private message  E-mail  Edit post Reply with quote


Easy. q3_ui/ui_confirm.c, replace this code:
Code:
void UI_ConfirmMenu( const char *question, void (*draw)( void ), void (*action)( qboolean result ) ) {
    UI_ConfirmMenu_Style(question, UI_CENTER|UI_INVERSE, draw, action);
}

With this:
Code:
void UI_ConfirmMenu( const char *question, void (*draw)( void ), void (*action)( qboolean result ) ) {
    if (action) {
        action(qtrue);
    }
}




Top
                 

Warrior
Warrior
Joined: 16 May 2006
Posts: 90
PostPosted: 04-06-2009 05:46 AM           Profile Send private message  E-mail  Edit post Reply with quote


^misantropia^ wrote:
Easy.


Not for me! :D Thank you very much!



_________________
Visit MONKEYS of DOOM at http://www.monkeysofdoom.org


Top
                 
Quake3World.com | Forum Index | Programming Discussion


Post new topic Reply to topic


cron
Quake3World.com
© ZeniMax. Zenimax, QUAKE III ARENA, Id Software and associated trademarks are trademarks of the ZeniMax group of companies. All rights reserved.
This is an unofficial fan website without any affiliation with or endorsement by ZeniMax.
All views and opinions expressed are those of the author.