IRC logs for #opendune on OFTC at 2009-10-03
            
01:47:45 *** ChanServ sets mode: +v Yexo
01:47:45 *** ChanServ sets mode: +v Xaroth
01:47:45 *** ChanServ sets mode: -o TrueBrain
02:32:27 *** glx has quit IRC
08:34:11 *** TrueBrain has quit IRC
08:34:19 *** TrueBrain has joined #openDune
09:02:35 *** Xaroth sets mode: +o TrueBrain
10:55:51 *** glx has joined #openDune
10:55:51 *** ChanServ sets mode: +v glx
11:13:18 <Xaroth> mornin
11:13:59 <TrueBrain> howdie
12:24:45 <TrueBrain> okay ... I need ... music ... and then lets get to work :)
12:26:18 <TrueBrain> Xaroth: I located exactly where and how memory for buildings is done
12:26:38 <TrueBrain> I will convert that, and I will make a 'building' struct of the correct size, but most entries I will fill in as 'variable_blabla'
12:29:12 <TrueBrain> and we need to think about g_input, as I now have an entry at 353F:35F4 .. putting that in g_input is silly, but creating a new global can be confusing because of the possible overlap
12:29:28 <TrueBrain> I don't know how big the 'data' page at 353F is in the end, and how it is in fact seperated in the original code
12:30:12 <TrueBrain> hmm .. it also contains strings and the like
12:30:23 <TrueBrain> so a g_global seems more obvious .. which we can split later on if we identified them all ;)
12:40:53 <DorpsGek> SVN: truebrain (r104) -Add: it turns out the 353F segment is a global general place for variables and constants, so rename g_input to g_global and make it act like that
12:41:21 <TrueBrain> not sure if this is the best move to make, but we will see ...
12:41:43 <glx> 3XXX are overlays IIRC
12:42:02 <TrueBrain> 3FFF is the first overlay, yes
12:42:05 <TrueBrain> well, 3FF1 :)
12:42:17 <TrueBrain> @calc 0x3ff10 - 0x353f0
12:42:17 <DorpsGek> TrueBrain: 43808
12:42:21 <TrueBrain> @base 10 16 43808
12:42:21 <DorpsGek> TrueBrain: AB20
12:42:33 <TrueBrain> leaves that many bytes, which will be the maximum for this data-segment :)
12:42:45 <TrueBrain> at 3EEE there is a bit of (overlay related) code
12:43:26 <TrueBrain> @calc 0x3eee0 - 0x353f0
12:43:26 <DorpsGek> TrueBrain: 39664
12:43:29 <TrueBrain> @base 10 16 39664
12:43:29 <DorpsGek> TrueBrain: 9AF0
12:43:43 <TrueBrain> and I already identified one entry at 986C
12:43:47 <TrueBrain> so that sounds about right ...
12:43:55 <TrueBrain> that is A LOT to identify ....
13:18:18 <TrueBrain> some things are just plain weird ...
13:18:34 <TrueBrain> at 35F4 is a CS:IP position where the buildings-array is, where each building is 0x58 in length
13:18:59 <TrueBrain> but at 0x8622 there is a small array which maps a building-slot-number to the CS:IP of where the building is
13:19:15 <TrueBrain> well .. I guess the last just saves a imul (but requires a tiny bit of memory)
13:19:36 <TrueBrain> @base 16 10 52
13:19:36 <DorpsGek> TrueBrain: 82
13:19:51 <TrueBrain> @calc 82 * 4
13:19:51 <DorpsGek> TrueBrain: 328
13:32:41 *** Yexo has quit IRC
13:36:47 <TrueBrain> for() cases should have else{} statements :p
13:53:39 <TrueBrain> http://devs.opendune.org/~truebrain/temp.patch <- anyone cares to read it through? Mostly if coding-style is a bit sane ..
13:57:19 <TrueBrain> 1:30 hour for such a small function ... lol :p
14:36:52 <TrueBrain> new patch ... the 'free' code is kind of weird
14:52:38 <TrueBrain> k, figured that out :)
14:52:39 <TrueBrain> ghehe :)
14:53:09 <TrueBrain> now I really need someone to proof-read it :p /me sits and waits :)
16:45:34 <nsz> msvc_packed gcc_packed.. :)
16:47:14 <nsz> it's still half asm.. and there are still gazillion f__xxxx definitions..
16:47:22 <nsz> but otherwise nice
16:49:42 <TrueBrain> euh, there are only 3 f__ definitions
16:50:05 <TrueBrain> and besides a few emu_ for popping and pushing and binding to a memory address, it should be pure C ...
16:50:26 <nsz> well i saw a couple of lines of extern declarations in the patch
16:50:31 <TrueBrain> 3, yes :)
16:50:35 <nsz> nah
16:50:36 <TrueBrain> outside the current scope :p
16:50:50 <TrueBrain> the others are removals of the big list of declarations
16:50:59 <nsz> decompiled.h
16:51:04 <nsz> is full of f__
16:51:12 <TrueBrain> yes ... you didn't really expect me to solve all functions at once? :)
16:51:21 <TrueBrain> (mind you it is in decompiled/, not in src/ ;))
16:51:32 <nsz> i was just saying what i saw :)
16:51:40 <nsz> also extern is implicit
16:51:50 <TrueBrain> not for mister MSVC, not in all cases :p
16:51:56 <nsz> oh
16:52:02 <nsz> D:
16:52:05 <TrueBrain> had that fight once ... I rather be explicit now :)
16:52:27 <TrueBrain> (well, it is only a problem with DLLs I believe, but still .. :p)
16:53:39 <TrueBrain> it is hard to find a way between keeping the memory in 16bit like nothing changed, and still make sense out of the code
16:53:51 <TrueBrain> + emu_dx.x = g_global->memoryBuildings >> 16;
16:53:52 <TrueBrain> + emu_ax.x = (g_global->memoryBuildings & 0xFFFF) + index * 0x58;
16:54:00 <TrueBrain> shit like that sucks, but without changing all the callers, I see no other way :(
16:55:56 <TrueBrain> either way, tnx nsz :)
16:57:14 <nsz> it was nothing
16:57:30 <TrueBrain> staying sane will be the hardest job here :p
16:57:41 <nsz> did ppl appear/contacted you about opendune?
16:57:48 <TrueBrain> nope
16:57:51 <nsz> i dont see much activity on the form
16:57:53 <nsz> forum
16:57:56 <TrueBrain> didn't expect any ;)
16:58:03 <nsz> ok :)
16:58:09 <TrueBrain> if we have a version that works reasonably well, I guess we should publish it on a few sites :)
17:45:40 <Xaroth> o/
18:21:56 <TrueBrain> I guess that concludes the comments of Xaroth :p
18:22:50 <DorpsGek> SVN: truebrain (r105) -Add: Memory_Building_Allocate and Memory_Building_Free, with a few wrappers and structs surrounding those functions
18:50:02 <Xaroth> yeh
18:50:06 <Xaroth> missus sitting next to me
18:50:44 <TrueBrain> awwhhh
18:50:49 * TrueBrain waves hello to the missus
19:21:18 <TrueBrain> @base 16 2 B
19:21:18 <DorpsGek> TrueBrain: 1011
20:26:48 <TrueBrain> @base 16 2 dffd
20:26:48 <DorpsGek> TrueBrain: 1101111111111101
20:27:32 <TrueBrain> I am trying to figure out 0x4 in the Building struct
20:27:35 <TrueBrain> but it is a bit unclear
20:27:39 <TrueBrain> just a general 'flag' it seems
20:27:52 <TrueBrain> emu_lfp(&emu_es, &emu_bx.x, &emu_get_memory16(emu_ss, emu_bp, 0x6));
20:27:54 <TrueBrain> emu_andw(&emu_get_memory16(emu_es, emu_bx.x, 0x4), 0xDFFF);
20:27:55 <TrueBrain> emu_lfp(&emu_es, &emu_bx.x, &emu_get_memory16(emu_ss, emu_bp, 0x6));
20:27:57 <TrueBrain> emu_andw(&emu_get_memory16(emu_es, emu_bx.x, 0x4), 0xBFFF);
20:27:58 <TrueBrain> LOL!
20:28:45 <TrueBrain> for sure the whole 0C3A is related to buildings
20:46:55 <DorpsGek> SVN: truebrain (r106) -Add: Building_Get_ByIndex2(), a function which looks up the cs:ip of a building by index (result in dx:ax)
20:47:18 <TrueBrain> oh, I never tested the change .. that is bad :p
20:47:30 <TrueBrain> yeah, it fails :p
20:47:31 <TrueBrain> haha
20:48:30 <DorpsGek> SVN: truebrain (r107) -Fix (r106): always test before commit ...
21:10:27 <Xaroth> heh
21:11:45 <Xaroth> missus went 'who the fuck is he?' when I told her you waved :P
21:11:55 <TrueBrain> haha :)
21:11:56 <Xaroth> then again, she does that to most people i know anyways
21:19:51 <TrueBrain> I uncovered a nice function which searches for a type of building (and I think owner)
21:26:33 <Xaroth> nice
21:26:51 <TrueBrain> I am considering if we should name functions that has to be called via the emu-convention differently
21:26:58 <TrueBrain> (the ones that still require pushes and pops of cs:ip)
21:28:39 <Xaroth> hm
21:29:06 <Xaroth> yeh, it's a bit hard to instantly remove all the emu stuff
21:29:24 <TrueBrain> functions of which the caller are not converted, are impossible to clean completely
21:29:30 <TrueBrain> it is a bottom-up approach :p
21:29:40 <TrueBrain> I now for example have:
21:29:41 <TrueBrain> Building *Building_Get_ByIndex(uint8 index)
21:29:43 <TrueBrain> {
21:29:44 <TrueBrain> return (Building *)&emu_get_memory8(g_global->memoryBuildings >> 16, g_global->memoryBuildings & 0xFFFF, index * 0x58);
21:29:46 <TrueBrain> }
21:29:47 <TrueBrain> hmm
21:29:49 <TrueBrain> too much, sorry :p
21:29:50 <TrueBrain> Building *Building_Get_ByIndex(uint8 index)
21:29:57 <TrueBrain> as pure C function, and
21:29:58 <TrueBrain> void Building_Get_ByIndex2()
21:30:06 <TrueBrain> as emu compatible function
21:30:09 <TrueBrain> (both doing the same)
21:30:35 <Xaroth> suffix Emu?
21:30:41 <Xaroth> Get_ByIndex_Emu
21:30:49 <TrueBrain> then prefix
21:30:53 <TrueBrain> easier to list
21:30:59 <Xaroth> Emu_Get_ByIndex?
21:31:05 <TrueBrain> Emu_Building_Get_ByIndex
21:31:07 <TrueBrain> yes
21:31:08 <Xaroth> or Emu_Building_Get_ByIndex
21:31:46 <TrueBrain> or maybe emu_Building_Get_ByIndex in this case
21:31:55 <TrueBrain> as in the end: grep "emu" * should result 0 results :p
21:32:08 <TrueBrain> (else grep -i "emu" *, which is not that big of a difference :p)
21:33:11 <Xaroth> grep emu_ ?
21:33:20 <TrueBrain> yes :p
21:33:25 <Xaroth> :)(
21:33:28 <Xaroth> s/(//
21:33:43 <TrueBrain> typing it over would have been more readable :p
21:33:57 <Xaroth> meh
21:33:59 <Xaroth> this is more geeky
21:42:16 <TrueBrain> are we going to call it 'owner' or 'house'?
21:42:32 <TrueBrain> I guess even ownerID or houseID is an option
21:45:23 <Xaroth> hm
21:45:35 <Xaroth> that regarding who owns a building in game?
21:45:37 <Xaroth> if so, ownerID
21:45:45 <Xaroth> in multiplayer multiple people can play the same house
21:45:47 <TrueBrain> but it also specifies the house who owns a building ;)
21:45:49 <Xaroth> so houseID will then fail
21:45:59 <TrueBrain> well, exactly that will fail anyway :)
21:46:10 <TrueBrain> as this field is used for drawing too ;)
21:46:12 <Xaroth> yeh, but houseID should be a property of the owner
21:46:20 <TrueBrain> that is very true
21:46:24 <TrueBrain> so owner or ownerID?
21:46:27 <TrueBrain> or ownerIndex :p
21:46:30 <TrueBrain> indexOwner :p
21:46:31 <TrueBrain> hahaha
21:46:37 <Xaroth> ownerID ?
21:47:08 <TrueBrain> type or typeID?
21:48:55 <Xaroth> if it's an indexed list, typeID
21:49:16 <TrueBrain> of course it is an indexed list :)
21:49:27 <Xaroth> well if it's an enum the index IS the list
21:49:38 <Xaroth> then it can be either
21:49:47 <TrueBrain> owner is also an enum ;)
21:49:55 <TrueBrain> so we go with ID as suffix for all such variables :)
21:49:59 <Xaroth> yeh
21:51:03 <TrueBrain> buildingCount or buildingsCount .. ghehe ;)
21:51:17 <Xaroth> building
21:52:18 <TrueBrain> netbeans is VERY useful for mass renaming :)
21:53:47 <Xaroth> heh
22:12:35 <TrueBrain> I assumed something was OwnerID, but it is showing values of -1 ...
22:12:37 <TrueBrain> weird
22:14:51 <TrueBrain> ah, wrong entry from struct
22:14:53 <TrueBrain> ghehe
22:14:58 <Xaroth> :o
22:15:58 <TrueBrain> I just converted 300 lines to 20 lines :p
22:15:59 <TrueBrain> haha
22:16:27 <Xaroth> tf O_O
22:16:32 <DorpsGek> SVN: truebrain (r108) -Add: Building_Find(), which find a building of a certain type and/or owner
22:17:36 <Xaroth> heh
22:18:12 <Xaroth> I'll also have a look at changing the hook tomorrow to show the amount of files changed
22:18:39 <DorpsGek> SVN: truebrain (r109) -Fix: rename a few variables to make slightly more sense
22:22:26 <TrueBrain> Xaroth: do you by chance know which id is what house?
22:22:29 <TrueBrain> (0, 1, 2)
22:22:47 <Xaroth> er, doonlunacy probably has that info
22:23:30 <TrueBrain> http://devs.opendune.org/~truebrain/temp.patch
22:23:31 <TrueBrain> clear enough?
22:23:42 <Xaroth> hm
22:23:42 <TrueBrain> (naming, of course)
22:23:58 <Xaroth> yeh
22:24:27 <DorpsGek> SVN: truebrain (r110) -Add: make an enum for Owner and BuildingType
22:24:40 <TrueBrain> if you have the time (in this week or what ever), could you give a look at the Owner enum?
22:25:01 <Xaroth> as in, find out which house is what?
22:25:09 <TrueBrain> yup
22:25:13 <TrueBrain> OWNER_HARKONNEN = ...
22:25:20 <TrueBrain> you also have that purple thingies and stuff
22:25:24 <TrueBrain> and maybe the buildings too ...
22:25:25 <Xaroth> Sardukar
22:35:54 <DorpsGek> SVN: truebrain (r111) -Add: introduce assert_compile, to validate struct-lengths on compile
22:38:25 <DorpsGek> SVN: truebrain (r112) -Add: sprankle enums all over the place
22:54:23 <TrueBrain> http://devs.opendune.org/~truebrain/temp.patch <- good idea / bad idea?
22:55:01 <TrueBrain> emu_ax.x = (size_t)b - (size_t)emu_memory - ((g_global->buildingStartPos >> 16) << 4) - (g_global->buildingStartPos & 0xFFFF); <- not a really pretty line :p
22:55:06 <Xaroth> the emu_ stuff?
22:55:08 <Xaroth> yeh
22:56:07 <TrueBrain> but it is now pure C, with a wrapper around it to still allow the emu_ calls
22:56:23 <Xaroth> that's the important part tbh
22:56:39 <TrueBrain> but from a pointer it gets a bit nasty to find the CS:IP back again :p
22:56:40 <Xaroth> cuz once we got most/all to C we need to be able to get rid of most/all the emu calls easily
22:56:46 <TrueBrain> yup
22:59:29 <TrueBrain> k, one clear rule: a function which isn't prefixed with emu_, should contain NO emu_ lines, with the exception of binding 16bit memory to a variable
22:59:55 <Xaroth> good idea
23:00:29 <DorpsGek> SVN: truebrain (r113) -Add: make pure C functions, with a tiny emu_ layer around it to still support the current emu_ based code
23:01:05 <TrueBrain> hmm .. that is kind of tricky :p
23:01:26 <TrueBrain> Memory_Building_Allocate for example, needs to do a push bp and stuff, because a non-translated function is called, which might walk the stack (overlays)
23:09:40 <TrueBrain> yeah, I like this solution of naming the functions emu_
23:09:46 <TrueBrain> does mean I need to revisit all functions I did so far
23:09:47 <TrueBrain> but okay :)
23:19:25 <TrueBrain> maybe even split it in files .. emu_building.c and building.c ..
23:22:45 <DorpsGek> SVN: truebrain (r114) -Codechange: prefix all functions with emu_, if they are not 100% pure C
23:29:34 <TrueBrain> slowly, things are getting into shape :)
23:31:31 <DorpsGek> SVN: truebrain (r115) -Change: moved memory.c into building.c; moved emu_ related functions to emu_building.c, to clearly show where there is still work
23:31:35 <TrueBrain> there :)
23:35:39 <Xaroth> :)
23:37:29 * glx updates msvc project :)
23:38:38 <TrueBrain> emu_Building_Find_First and emu_Building_Find_Next, sensible names?
23:38:51 <TrueBrain> (you call First as first, then you run Next as long as it returns non-NULL)
23:39:06 <Xaroth> should work
23:39:21 <glx> http://glx.dnsalias.net:8080/openttd/opendune_msvc.diff
23:41:03 <DorpsGek> SVN: truebrain (r116) -Add: it turns out Building_Find is split in Building_Find_First and Building_Find_Next
23:41:33 <DorpsGek> SVN: truebrain (r117) -Update: MSVC project file (glx)
23:42:04 <TrueBrain> I need to make something pretty out of those Find_ functions, but that is something for another day :p
23:42:13 <Xaroth> yeh, it's almost 2am o_O
23:42:16 <Xaroth> missus still awake O_O
23:42:42 <glx> these functions looks like MS functions with underscore ;)
23:43:03 <TrueBrain> okay, that is something we need to change :p
23:44:06 <glx> ha no, MS uses FindFirstXXX and FindNextXXX indeed
23:44:37 <TrueBrain> @calc 0x58 * 0x82
23:44:37 <DorpsGek> TrueBrain: 11440
23:44:41 <TrueBrain> @base 10 16 11440
23:44:41 <DorpsGek> TrueBrain: 2CB0
23:44:49 <TrueBrain> @calc 0x58 * 82
23:44:49 <DorpsGek> TrueBrain: 7216
23:44:52 <TrueBrain> @base 10 16 7216
23:44:52 <DorpsGek> TrueBrain: 1C30
23:45:27 <Xaroth> @calcbase :P
23:45:53 <glx> @help calcbase
23:45:53 <DorpsGek> glx: Error: There is no command "calcbase".
23:51:21 <TrueBrain> k, 1 function left in 1082 to identify ..
23:52:04 <TrueBrain> it recounts all buildings
23:52:08 <TrueBrain> which is a bit weird if you ask me
23:53:17 <Xaroth> off 2 bed
23:53:20 <Xaroth> nn :)
23:53:22 <TrueBrain> yeah, me 2
23:53:23 <TrueBrain> night!