how disable cd key check?

Locked
michael18
Posts: 26
Joined: Fri Apr 04, 2008 4:08 pm

how disable cd key check?

Post by michael18 »

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
epicgoo
Posts: 44
Joined: Sun Mar 01, 2009 4:24 pm

Re: how disable cd key check?

Post by epicgoo »

it is not legal
also you dont need to enter anything
michael18
Posts: 26
Joined: Fri Apr 04, 2008 4:08 pm

Re: how disable cd key check?

Post by michael18 »

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?
epicgoo
Posts: 44
Joined: Sun Mar 01, 2009 4:24 pm

Re: how disable cd key check?

Post by epicgoo »

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
Silicone_Milk
Posts: 2237
Joined: Sat Mar 12, 2005 10:49 pm

Re: how disable cd key check?

Post by Silicone_Milk »

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!
Herr W
Posts: 90
Joined: Tue May 16, 2006 8:53 am

Re: how disable cd key check?

Post by Herr W »

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! ;)
[color=#FF0000]Visit MONKEYS of DOOM at [url]http://www.monkeysofdoom.org[/url][/color]
Kaz
Posts: 1077
Joined: Wed Mar 08, 2006 3:43 am

Re: how disable cd key check?

Post by Kaz »

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...
^misantropia^
Posts: 4022
Joined: Sat Mar 12, 2005 6:24 pm

Re: how disable cd key check?

Post by ^misantropia^ »

Yep, it branched from ioquake3 nearly two years ago (rev 1106, I think).
Herr W
Posts: 90
Joined: Tue May 16, 2006 8:53 am

Re: how disable cd key check?

Post by Herr W »

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...
[color=#FF0000]Visit MONKEYS of DOOM at [url]http://www.monkeysofdoom.org[/url][/color]
^misantropia^
Posts: 4022
Joined: Sat Mar 12, 2005 6:24 pm

Re: how disable cd key check?

Post by ^misantropia^ »

UI_MainMenu() in q3_ui/ui_menu.c. Remove this bit:

Code: Select all

    if( !uis.demoversion && !ui_cdkeychecked.integer ) {
        char    key[17];

        trap_GetCDKey( key, sizeof(key) );
        if( trap_VerifyCDKey( key, NULL ) == qfalse ) { 
            UI_CDKeyMenu();
            return;
        }
    }
Herr W
Posts: 90
Joined: Tue May 16, 2006 8:53 am

Re: how disable cd key check?

Post by Herr W »

Great, works! Thanks a lot once again! :)
[color=#FF0000]Visit MONKEYS of DOOM at [url]http://www.monkeysofdoom.org[/url][/color]
Silicone_Milk
Posts: 2237
Joined: Sat Mar 12, 2005 10:49 pm

Re: how disable cd key check?

Post by Silicone_Milk »

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 -_-
Herr W
Posts: 90
Joined: Tue May 16, 2006 8:53 am

Re: how disable cd key check?

Post by Herr W »

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: Select all

/*
=================
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:
[color=#FF0000]Visit MONKEYS of DOOM at [url]http://www.monkeysofdoom.org[/url][/color]
Herr W
Posts: 90
Joined: Tue May 16, 2006 8:53 am

Re: how disable cd key check?

Post by Herr W »

Hm... No, doesn't work that way.
[color=#FF0000]Visit MONKEYS of DOOM at [url]http://www.monkeysofdoom.org[/url][/color]
epicgoo
Posts: 44
Joined: Sun Mar 01, 2009 4:24 pm

Re: how disable cd key check?

Post by epicgoo »

"qboolean" is the type of "result"
qtrue and qfalse are possible values for "result". they are not types :)
Kaz
Posts: 1077
Joined: Wed Mar 08, 2006 3:43 am

Re: how disable cd key check?

Post by Kaz »

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: Select all

   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: Select all

/*
=================
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.
Herr W
Posts: 90
Joined: Tue May 16, 2006 8:53 am

Re: how disable cd key check?

Post by Herr W »

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: Select all

/*
=================
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...)
[color=#FF0000]Visit MONKEYS of DOOM at [url]http://www.monkeysofdoom.org[/url][/color]
^misantropia^
Posts: 4022
Joined: Sat Mar 12, 2005 6:24 pm

Re: how disable cd key check?

Post by ^misantropia^ »

You want every confirmation menu to not display and act like the user clicked 'Yes'? Or only one or two specific instances?
Herr W
Posts: 90
Joined: Tue May 16, 2006 8:53 am

Re: how disable cd key check?

Post by Herr W »

^misantropia^ wrote:You want every confirmation menu to not display and act like the user clicked 'Yes'?
Exactly!
[color=#FF0000]Visit MONKEYS of DOOM at [url]http://www.monkeysofdoom.org[/url][/color]
^misantropia^
Posts: 4022
Joined: Sat Mar 12, 2005 6:24 pm

Re: how disable cd key check?

Post by ^misantropia^ »

Easy. q3_ui/ui_confirm.c, replace this code:

Code: Select all

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: Select all

void UI_ConfirmMenu( const char *question, void (*draw)( void ), void (*action)( qboolean result ) ) {
    if (action) {
        action(qtrue);
    }
}
Herr W
Posts: 90
Joined: Tue May 16, 2006 8:53 am

Re: how disable cd key check?

Post by Herr W »

^misantropia^ wrote:Easy.
Not for me! :D Thank you very much!
[color=#FF0000]Visit MONKEYS of DOOM at [url]http://www.monkeysofdoom.org[/url][/color]
Locked