PDA

View Full Version : Big stupid question.


Grindel
05-12-2006, 05:57 AM
Is it possable to to replace or some how trick the game to starting up to your custom mod. When i hit new game create a character and it spawns in a map can i make that my own map. Total game replacement. Perhaps we have to trick it by replaceing the existing startup map with a custom map using the same name.

Well i thought i would ask anyways. I'm super n00b. I have finished the Doom Dealer tutorial. and was wondering about such things.
Thanks for any feedback/namecalling i get in response to this post.

Darkkender
05-14-2006, 06:38 PM
Yes it is very much possible. This is the key element behind most storyline mods. While I have not officially announced it yet I have been working on a storyline mod just as Gsccc has been working on his. The key element is to edit the scripting to load your module and not the games ffirst one. There is also an easy cheater method which is to determine which module is loaded first in the game (Endar Spire for K1, or Ebon Hawk(Tut) for K2) then create a "mod" file that begins the same as that modules rim files. "Mod" files act just like a Override folder for "rim" files.

I would recomend though determining which script is run to start the game and just edit it though to have a new module loaded at the beginning.

stoffe
05-14-2006, 07:13 PM
The key element is to edit the scripting to load your module and not the games ffirst one. There is also an easy cheater method which is to determine which module is loaded first in the game then create a "mod" file that begins the same as that modules rim files.

Naming the new module the same as the standard starting module works, and is probably the only way it can be done. The name of the first module to launch when starting a new game is hardcoded in swkotor2.exe and is not set in any scripts.

Darkkender
05-14-2006, 07:23 PM
Off the top of my head I can't recall the script name but it is actually in one of the scripts. I have already been doing just this for Project "THOR". I'll try to remember to look at my files tonight and post which script it is that launches the scroller followed by the module.

Grindel
05-15-2006, 01:00 AM
I thought it would have something to do with overrideing the first module (TSL 001EBO). Not that I would be concernd with this any time soon. I just started modding myself. However at some point in the future i intend to do a total replacement of the story line. The same old story slightly with slight mods or added side quest gets old fast. One mod I totaly like it the "CSArena" mod by stoffe. Very nice for leveling a character. I feel the story line is a bit liner (<-- not sure about that spelling :P ) Anyways thanks for all the responses. Good luck with your mods.

stoffe
05-15-2006, 06:04 AM
Off the top of my head I can't recall the script name but it is actually in one of the scripts. I have already been doing just this for Project "THOR". I'll try to remember to look at my files tonight and post which script it is that launches the scroller followed by the module.

Eh? There is no script in my TSL game at least that launches the 001EBO module at the start of the game. I doubt the game engine runs any scripts at all while no module is loaded.

The OnEnter script for the 001EBO area, a_bet3m4.ncs, plays the StarWars scroller BIK movie when the area is first entered by the player after the module has been loaded. Perhaps this is what you are thinking of? The name of the first module to load, which contains this script, is hardcoded in swkotor2.exe from what I can tell.

Grindel
05-15-2006, 06:40 AM
Humm as a programmer I would think that loading of the first level wouldn't be hardcoded into the game engin. Most of the game engines that i have looked at use some sort of external data file to determin the what is to be loaded first. However I have no real knowladge of how the TSL engin works, so this is just speculation. However I'm going to go look at if right now and see wut I can see. Just to settle the qwestion, if not for anyone else for myself.

Grindel
05-15-2006, 07:50 AM
*WARNING*WARNING*WARNING*WARNING*WARNING*WARNING*W ARNING*WARNING*

EXTREAM CAUTION IS WARENTED
DO NOT EDIT YOUR ONLY COPY OF THE EXECUTABLE. EDITING EXECUTABLE PROGRAMS IN THIS WAY CAN CAUSE SERIOUS ERRORS. IF YOU EDIT YOUR EXECUTABLE AND HAVE PROBLEMS DON'T LOOK FOR ME, I WARNED YOU.

However I may be wrong. meaning I found it. being an old skewl hacker I hacked the game. I loaded up my trusty Hex editor, (Yey) And looked for the string 001ebo. It so happens I found the right one on the first try.
at address 3CBF8C you will find the text string "101ebo" I changed this to "101per" and loaded a new game. sure enough this loads map one of peragis. I have further tested this by loading my own module. By changeing "001ebo" to "narmod" and now it loads my module as the first map. I really hate to edit the executable to acomplish this, I would rather edit some configuration file of some type. I'm not sure at all if this will cause bugs of any kind. However my PC seems to interact normally with objects and NPC's. There are no problems as far as I can tell with what little testing I did after makeing this hack.

*WARNING*WARNING*WARNING*WARNING*WARNING*WARNING*W ARNING*WARNING*

EXTREAM CAUTION IS WARENTED
DO NOT EDIT YOUR ONLY COPY OF THE EXECUTABLE. EDITING EXECUTABLE PROGRAMS IN THIS WAY CAN CAUSE SERIOUS ERRORS. IF YOU EDIT YOUR EXECUTABLE AND HAVE PROBLEMS DON'T LOOK FOR ME, I WARNED YOU.

Grindel
05-15-2006, 08:28 AM
Update there seems to be trailing Nulls after the text string
"narmod□□□□□□" <-- as string.
"6E 61 72 6D 6F 64 00 00 00 00 00 00" <-- as hex.

I then tested to see if a character string longer than the standard nameing convintion used by Bioware could be used. (3 numbers 3 letters e.g. XXXXXX) Renameing "narmod.mod" to "narmodX.mod" and then changing the the values in the swkotor2.exe from "narmod□□□□□□" to "narmodX□□□□□" seems to have worked as well. So from this experiment I make the assumption that we have a 12 character namespace to work with. Well I'm really happy i could settle this debate. Now we can work on a compleate revamp of the game :)

Pavlos
05-15-2006, 11:58 AM
Uh...

Well, I can safely say that you will probably be in a spot of trouble with our Moderators as hacking the executable is ILLEGAL and violates the EULA that you signed by installing KotOR I/II. Pleas consult the rules (http://www.lucasforums.com/showthread.php?t=127725) before posting anything of this nature.

newszi
05-15-2006, 12:04 PM
If I modifiy memory values allocated by swkotor.exe, that too is Illegal?

Darkkender
05-15-2006, 12:25 PM
After looking at my overide for my Project THOR it is the onenter script used in the 001EBO area, a_bet3m4.ncs. I had originally tried playing with overiding a_playpermovie.ncs but that can have foul ups in the start of the game.

I personally prefer the scripting method over the creating a new module and naming it after the first module.

Pavlos
05-15-2006, 12:29 PM
As do I. Generally, if I create new modules, I use my own naming convention:

ral - The first three letters of the planet
m01 - Module one within this area

so: ral_m01

Grindel
05-15-2006, 01:37 PM
Uh...

Well, I can safely say that you will probably be in a spot of trouble with our Moderators as hacking the executable is ILLEGAL and violates the EULA that you signed by installing KotOR I/II. Pleas consult the rules (http://www.lucasforums.com/showthread.php?t=127725) before posting anything of this nature.

1. Humm interesting. Not that I cannot read the agreement for myself, but could you point out the area in the EULA that this is stated.

2. Any EULA or any part of any EULA the specifies that the end user cannot modify the executable is by it's nature invalid. The reason being is if I, the end user, purchase a software license and load the software onto my machine. I have full access to that software it's data and it's machine code. I can and will modify it in anyway I see fit because I own that copy exclusively. I believe you may be thinking about the part about modification and redistribution. I cannot modify the code and redistribute it as my own work. I cannot derive a work from IP owned by LA and redistribute it as my own. I can however modify and executable or data that I buy a license for.

3. As some one who is trained as a software designer, I make it my business to know about IP rights. If infact the EULA dose restrict the modification of the software I will definatly contact the IEEE concerning this matter.

ChAiNz.2da
05-15-2006, 02:20 PM
well just to step in (temporarily).. ;)

trust me Grindel you've captivated the attention of several of us modders.. and I can go on record saying that *I* have no problem with the discussion. As you've stated.. it's the "re-distribution" ( .exe specifically) portion that's the kicker...and will more than likely stick. However, tutorials, posts and such are regarded differently ;) There's nothing in the rules that says I can't screw up my game in any way I see fit.. hehehe

Keep in mind (as I'm positive you are aware) that topics covering security measures and proprietory code are no-no's (duh) and since LF is not an affiliate with Lucas Arts we have to keep the dotted lines on our necks hidden from the axe... since in respect, ALL mods violate the EULA and we've been graced by Lucas Arts that the legal "sharks" are kept at bay (hehehe..apologies Darth333 for the lawyer term)

Pavlos has your best intentions in mind when he posted, so don't be upset or take offense in the matter... usually when someone mentions "porting" or other means of altering game assets..err, "differently".. it's a free-for-all.. hehehe.. and the word "hacking" perks ears around here ;) But yeah, it IS hacking (as opposed to cracking).. so I think it's just a hot keyword wrongfully associated with miscreants...

This particular discussion on "hacking" .exe is very intriguing.. please bear with us, and a little patience until we can get a clear "yay or nay" on what we're allowed to discuss (publicly) ... but just know that there's several of us modders who are very much wanting to hear what you've discovered (and/or any future progress)...and are finding suitable guidelines/compromises that keeps everyone happy and out of litigation.. hehehe..

BTW, Kudos on your discoveries thus far :D

stoffe
05-15-2006, 02:47 PM
So from this experiment I make the assumption that we have a 12 character namespace to work with. Well I'm really happy i could settle this debate. Now we can work on a compleate revamp of the game :)

While I haven't analyzed this further I would assume that the name of the module is stored in the EXE as a standard ResRef, since that's what the name is. This means it's a 16 char array which is nullpadded if the actual value is shorter than the max length.

I don't know if it's a good idea to modify the EXE though in any case. It's probably illegal to upload it with a mod. And maybe I'm just paranoid, but I sure wouldn't use a mod that patched in changes to the game executable. :)

After looking at my overide for my Project THOR it is the onenter script used in the 001EBO area, a_bet3m4.ncs. I had originally tried playing with overiding a_playpermovie.ncs but that can have foul ups in the start of the game.

I personally prefer the scripting method over the creating a new module and naming it after the first module.

As said, a_bet3m4.ncs runs inside the first module after it has already been loaded by the game. The a_playpermovie.ncs script is a dialog action script, used in a few dialogs, also after a module has already been loaded. Neither of these scripts govern which module is the first loaded by the game. There isn't a "scripting method" that isn't a workaround.

Though as a workaround you can of course edit said script to immediately transition to another module as soon as the 001EBO module has been loaded. But you can't use scripts to prevent 001EBO from loading to begin with. :)

Grindel
05-15-2006, 02:58 PM
My appologies if my last post seemed to have edge to it. I was a little irritated though. I find this kewl thing tweaking. Then somone threatens to put the kibash on it. I jumped to the defencive. So anyway i'm sorry if I came off wrong. :)

newszi
05-15-2006, 02:58 PM
As said, a_bet3m4.ncs runs inside the first module after it has already been loaded by the game. The a_playpermovie.ncs script is a dialog action script, used in a few dialogs, also after a module has already been loaded. Neither of these scripts govern which module is the first loaded by the game. There isn't a "scripting method" that isn't a workaround.

I prefer altering the intro.dlg in 001ebo so you can choose if you want to play the mod, te prologue, or peragus, etc... there is no need for hexing and such...

Grindel
05-15-2006, 07:12 PM
While I haven't analyzed this further I would assume that the name of the module is stored in the EXE as a standard ResRef, since that's what the name is. This means it's a 16 char array which is nullpadded if the actual value is shorter than the max length.

I don't know if it's a good idea to modify the EXE though in any case. It's probably illegal to upload it with a mod. And maybe I'm just paranoid, but I sure wouldn't use a mod that patched in changes to the game executable. :)

Your wrong on the first point having seen it first hand I know there are only 12 bytes from where the string begins until another non null byte. This would effectively give us 11 bytes of space to work with. As you said your self any string/character array is null padded. Here look for yourself.
http://www.freewebs.com/grindel/HexScr.png

As for the second point. I do know it not a good idea to edit the executable. I would never ever recommend to a user to edit their executable in any way shape or form. However this isn't a forum about how to play the game it's about how to mod and change it. From a cretin perspective every time you load a custom modeled light saber grip into the game you are in essence changing the executable in a way that it was not designed or intended for. the executable is nothing more that a string of bits on your hard disk or in active memory. All those polygons are in fact variables that are processed by the executable while it resides in active memory. Adding a custom model inserts variables that the executable was not intended to process. I have done no less by changing a variable that was hard coded into the sources of the game. Any programmer knows that there are only two types of data. instructions and variables. I changed a variable. if I change and instruction (not that it cannot be done) it could have far reaching ramifications.

However I'm with you I wouldn't go mucking around with a hex editor in my executables if I could help it.

and as far as uploading the executable with a mod... certainly not.

newszi
05-15-2006, 08:25 PM
But we asked if it possible so you answered, even thought, noone will use this method, but thanks ... :D

Grindel
05-16-2006, 02:18 PM
But we asked if it possible so you answered, even thought, noone will use this method, but thanks ... :D

no one would use this method?? Really...

oh and by the way I asked if it were possable.


trust me Grindel you've captivated the attention of several of us modders..

Why wouldn't anyone use it?? Could you explain?

ChAiNz.2da
05-16-2006, 02:37 PM
Why wouldn't anyone use it?? Could you explain? Who Me? :confused:

I don't think I said *I* wouldn't use it (of course, making a backup would be a necessity) ;)

But the topic is a bit taboo.. and without official endorsement from LA, discussion over hacking the .exe, much less distributing an .exe or even a patching utility to alter the .exe is out of bounds for LFnet... we already disallow discussion/mods/etc. over porting, and to allow it over hacking executables would be a bit hypocritical...

I'm sorry, really it's nothing personal.. I find your discoveries most fascinating, but also these forums aren't name "ChAiNz.2da Forums" either :xp: and I'm bound by the rules and etiquette established by these boards, their administrators and super-mods..

To answer the question more generically however.. I would tend to think that most others are "iffy" about anything that alters such an important file for the game (again, simply solved by ensuring you make a backup).. but to this day.. most ppl won't even use a mod that alters a chitin key or even the .tlk file :giveup: at least with the override folder, major problems can be fixed simply by deleting the problem file..

Also, because of hysteria (read: paranoia) over internet and compy security... anyone in their right mind would be wary of running an .exe even if it was stated that it's just a mod.. surely from one 'hacker' to another, you can understand where I'm coming from ;)

Trust me, if it wasn't for stoffe's, tk102's & Fred's long-standing great reputation, admiration, and openess to discussion of the inner-workings of their program(s) (what exactly it alters).. I'm sure the TSLPatcher, KSE, & KotOR Tool would've come under scrutiny as well.. and they would've been forbidden had it tampered with the main .exe in doing so..

Dems the rules.. and I like these forums too much to jeopardize their downfall..

newszi
05-16-2006, 02:41 PM
Originally Posted by stoffe -mkb-
I don't know if it's a good idea to modify the EXE though in any case. It's probably illegal to upload it with a mod. And maybe I'm just paranoid, but I sure wouldn't use a mod that patched in changes to the game executable.


Originally Posted by Grindel
no one would use this method?? Really...
I meant noone will use it for mods meant to be publicated.

Darth333
05-16-2006, 04:48 PM
As interesting as it may be, I have to close this topic.

For various reasons, including liability issues, LucasForums cannot accept discussions about modifying the executable on its boards. Whether distribution is intended or not, whether there are other solutions or not, we don't want to see this here. It's a line we won't cross.


2. Any EULA or any part of any EULA the specifies that the end user cannot modify the executable is by it's nature invalid. The reason being is if I, the end user, purchase a software license and load the software onto my machine. I have full access to that software it's data and it's machine code. I can and will modify it in anyway I see fit because I own that copy exclusively. I believe you may be thinking about the part about modification and redistribution. I cannot modify the code and redistribute it as my own work. I cannot derive a work from IP owned by LA and redistribute it as my own. I can however modify and executable or data that I buy a license for.

It's not solely a distribution issue. You don't own the software. The license transfers you some rights but there are limits too. Perhaps this (http://caselaw.lp.findlaw.com/data2/circs/2nd/039303p.pdf) may shed some light on the issue. Should you want to discuss this further, feel free to PM me.