Gamestudio Links
Zorro Links
Newest Posts
nba2king Latest Roster Update Breakdown
by joenxxx. 10/14/25 06:06
Help!
by VoroneTZ. 10/14/25 05:04
Zorro 2.70
by jcl. 10/13/25 09:01
ZorroGPT
by TipmyPip. 10/12/25 13:58
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 10/11/25 18:45
Reality Check results on my strategy
by dBc. 10/11/25 06:15
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
2 registered members (Quad, AndrewAMD), 9,200 guests, and 10 spiders.
Key: Admin, Global Mod, Mod
Newest Members
joenxxx, Jota, krishna, DrissB, James168
19170 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 3 1 2 3
Re: Location of _sphere.mdl, _cube.mdl and _shadow.dds [Re: WretchedSid] #435976
01/16/14 17:04
01/16/14 17:04
Joined: Aug 2002
Posts: 3,258
Mainz
oliver2s Offline OP
Expert
oliver2s  Offline OP
Expert

Joined: Aug 2002
Posts: 3,258
Mainz
Originally Posted By: JustSid
Which also answers Olivers question.


Not really. Still don't know how to add these files as buffers.

Re: Location of _sphere.mdl, _cube.mdl and _shadow.dds [Re: WretchedSid] #435977
01/16/14 17:14
01/16/14 17:14
Joined: Mar 2010
Posts: 57
LemmyTheSlayer Offline
Junior Member
LemmyTheSlayer  Offline
Junior Member

Joined: Mar 2010
Posts: 57
the mdl7 sdk revealed three models in the file (MDL7's magic number is "MDL7").
it would be possible to extract them from the dll.
another way would be to serialize it to disk at runtime using the ent.model pointer.


SCHLEIFE SCHLEIFE SCHLEIFE SCHLEIFE SCHLEIFE SCHLEIFE
Re: Location of _sphere.mdl, _cube.mdl and _shadow.dds [Re: oliver2s] #435978
01/16/14 17:15
01/16/14 17:15
Joined: Apr 2007
Posts: 3,751
Canada
WretchedSid Offline
Expert
WretchedSid  Offline
Expert

Joined: Apr 2007
Posts: 3,751
Canada
Okay, so, the engine does the following in engine_open() to load the WRS:

Code:
10046563 A154031F10                      mov        eax, dword [ds:0x101f0354]
10046568 50                              push       eax
10046569 E822C1FEFF                      call       sub_10032690
1004656e 83C404                          add        esp, 0x4



0x101f0354 is the address which contains the address to the WRS section inside the acknex.dll. It's akin to the following code C:

Code:
sub_10032690(*(char **)(0x101f0354));



sub_10032690() is also called by add_resource(), and it appears to first do some processing/sanity checks on the string and then call into sub_10032690(), so it's fair to assume that simply pumping anything that looks like a WRS into add_resources() will do the trick.

Ideally you would want to get the address to the WRS, hardcoding is meh because dlls change and that would break your stuff and ugh... Well, the symbol isn't exported, so no way. However, WRS has a header, the ASCII string "WRS3".

Sooo, to wrap it all up:
Load the acknex.dll into a buffer, search for the ASCII string "WRS3" (which exists twice, so you probably want to load both(?!)), and then pass the location where you found it into add_resources(). Tada, you are done.

Ideally, you look for the header at startup, store all locations, and then use the cached value, instead of looking for it over and over again.

Edit: You may be able to speed it up by starting your search around the offsets where the WRS files currently are, and only if you can't find it there (+/- 200 bytes or so), search through the whole file.

Last edited by JustSid; 01/16/14 17:16.

Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com
Re: Location of _sphere.mdl, _cube.mdl and _shadow.dds [Re: WretchedSid] #435981
01/16/14 17:24
01/16/14 17:24
Joined: Oct 2011
Posts: 1,082
Germany
C
Ch40zzC0d3r Offline
Serious User
Ch40zzC0d3r  Offline
Serious User
C

Joined: Oct 2011
Posts: 1,082
Germany
You dont need a fixpoint to find addresses on new files.
Do a signature scan (scans for a known/unknown byte sequence) and you will find it in every dll tongue
However, what sid wrote is right, but the section is not loading a WRS file from the directory (I extracted them and theres no _cube.mdl and so on) so I think the buffer might be hardcoded. If you really need those things, you can click them together in MED too xD

Re: Location of _sphere.mdl, _cube.mdl and _shadow.dds [Re: Ch40zzC0d3r] #435982
01/16/14 17:36
01/16/14 17:36
Joined: Apr 2007
Posts: 3,751
Canada
WretchedSid Offline
Expert
WretchedSid  Offline
Expert

Joined: Apr 2007
Posts: 3,751
Canada
Originally Posted By: Ch40zzC0d3r
However, what sid wrote is right, but the section is not loading a WRS file from the directory

Which one? The one I pasted from engine_open()? It does...

However, I just noticed, the first instance of WRS3 is just a normal string... So, if you find an occurence of WRS3 followed by a null character... That's not an actual WRS but a string. The real WRS3 (of which there only exists one) starts with WRS3 followed by some non ASCII characters.


Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com
Re: Location of _sphere.mdl, _cube.mdl and _shadow.dds [Re: WretchedSid] #435983
01/16/14 17:40
01/16/14 17:40
Joined: Oct 2011
Posts: 1,082
Germany
C
Ch40zzC0d3r Offline
Serious User
Ch40zzC0d3r  Offline
Serious User
C

Joined: Oct 2011
Posts: 1,082
Germany
Whats the name of the WRS?
I found 2 in GS folder and extracted both, but there were no debug mdls.

Re: Location of _sphere.mdl, _cube.mdl and _shadow.dds [Re: Ch40zzC0d3r] #435985
01/16/14 17:42
01/16/14 17:42
Joined: Aug 2002
Posts: 3,258
Mainz
oliver2s Offline OP
Expert
oliver2s  Offline OP
Expert

Joined: Aug 2002
Posts: 3,258
Mainz
Originally Posted By: Ch40zzC0d3r
If you really need those things, you can click them together in MED too xD


Yes, I've wanted to avoid this. But it seems there's no other way than to create my own cube, sphere and shadow.

Re: Location of _sphere.mdl, _cube.mdl and _shadow.dds [Re: Ch40zzC0d3r] #435986
01/16/14 17:43
01/16/14 17:43
Joined: Apr 2007
Posts: 3,751
Canada
WretchedSid Offline
Expert
WretchedSid  Offline
Expert

Joined: Apr 2007
Posts: 3,751
Canada
It's in the acknex.dll at offset 0x101f04dc.

That's why I'm saying, open the acknex.dll and search for the WRS header, then just throw that location at add_resource().

Edit: Uh? I explained how you get the resource to load and the default files back. You don't need to click them together in MED.

Last edited by JustSid; 01/16/14 17:44.

Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com
Re: Location of _sphere.mdl, _cube.mdl and _shadow.dds [Re: WretchedSid] #435987
01/16/14 17:45
01/16/14 17:45
Joined: Aug 2002
Posts: 3,258
Mainz
oliver2s Offline OP
Expert
oliver2s  Offline OP
Expert

Joined: Aug 2002
Posts: 3,258
Mainz
Originally Posted By: JustSid
It's in the acknex.dll at offset 0x101f04dc


But this seems not to be a good solution. The offset might change in future updates.

Re: Location of _sphere.mdl, _cube.mdl and _shadow.dds [Re: oliver2s] #435989
01/16/14 17:52
01/16/14 17:52
Joined: Apr 2007
Posts: 3,751
Canada
WretchedSid Offline
Expert
WretchedSid  Offline
Expert

Joined: Apr 2007
Posts: 3,751
Canada
Yes... That's why I wrote that you should search for the WRS header...

Here is a quick and untested implementation:
Code:
char *_acknex_dll  = NULL;
char *_default_wrs = NULL;

void reload_defaultWRS()
{
	if(!_acknex_dll)
	{
		// Read the acknex.dll in
		FILE *file = fopen(_chr(str_printf(NULL, "%s\\%s", _chr(exe_dir), "acknex.dll")), "rb");
		fseek(file, 0, SEEK_END);
		long length = ftell(file);
		fseek(file, 0, SEEK_SET);

		_acknex_dll = malloc(length);
		fread(_acknex_dll, length, 1 file);
		fclose(file);

		// Look for the WRS resource
		char *temp = _acknex_dll;
		while(1)
		{
			temp = strstr(temp, "WRS3");
			if(!temp)
				break;

			if(temp[4] == '\0') // strings in the string section are terminated with a 0 byte, so if there is one, this isn't the WRS we are looking for
			{
				temp += 4;
				continue;
			}

			_default_wrs = temp;
			break;
		}
	}

	if(!_default_wrs)
	{
		error("Couldn't find default WRS!");
		return;
	}

	add_resource(_default_wrs);
}



Edit: Dunno if Lite-C has strstr() or not... If it doesn't, here is an implementation:
Code:
char *strstr(char *str1, const char *str2)
{
	size_t index = 0;
	size_t length = strlen(str2);
	char *start = NULL;
	
	for(; *str1 != '\0'; str1++)
	{
		if(*str1 == str2[index])
		{
			if(index == 0)
				start = str1;
			
			index ++;
			if(index == length)
				return start;
		}
		else
		{
			index = 0;
		}
	}
	
	return NULL;
}


Last edited by JustSid; 01/16/14 17:54.

Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com
Page 2 of 3 1 2 3

Moderated by  old_bill, Tobias 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1