IRC logs for #opendune on OFTC at 2011-03-27
⏴ go to previous day
08:39:59 *** Alberth has joined #openDune
12:17:57 <Alberth> we are in the 'or something' part, apparently :)
12:19:05 <Alberth> or are my efforts so useless, or should I submit them in another way?
12:22:07 <TrueBrain> ugh; I wish I had time Alberth :(
12:22:12 <TrueBrain> university is eating all my time :(
12:22:38 <Alberth> it must be hungry then :)
12:23:32 <TrueBrain> a few pointers: try to remove emu_[abcd]x and emu_[ds]i assignments where possible
12:23:41 <TrueBrain> in general you have to leave emu_ax and emu_dx from time to time
12:23:45 <TrueBrain> emu_si and emu_di are never needed :)
12:24:01 <TrueBrain> var06 = emu_get_memory16(emu_ss, emu_bp, 0x6); <- please look at other emu_ functions how to do that nicely :)
12:24:40 <TrueBrain> emu_pop(&emu_cx); <- at the end of a function that is often called. What it means is: emu_sp += 2;
12:24:50 <TrueBrain> up to emu_sp += 4, it uses 2 pops, because it was faster on 16bit platforms :)
12:25:20 <TrueBrain> about emu_di and emu_si: I often rename them to locsi and locdi
12:26:38 <TrueBrain> owh, it is, later on
12:26:52 <TrueBrain> emu_dx & 0x8000 <- signed check
12:26:58 <TrueBrain> well, if negative ;)
12:27:11 <TrueBrain> so emu_dx + emu_ax are together a 32bit signed integer
12:27:16 <TrueBrain> might be best to replace it with that :D
12:27:31 <TrueBrain> + if (g_global->variable_31B2.s.ip == 0 && g_global->variable_31B2.s.cs == 0) { <- or: 31B2.csip == 0x0 ;)
12:27:49 <TrueBrain> - emu_push(emu_ax);
12:27:51 <TrueBrain> + emu_push(0xFFFF);
12:27:54 <TrueBrain> emu_ax assignemnt can also be removed
12:28:11 <TrueBrain> emu_push(0x0174); emu_Unknown_B53B_0000();
12:28:35 <TrueBrain> because emu_cx will be damaged, please add a emu_cs =(blabla) overlay(blabla) part inb etween, like in other places (B53B == 353B)
12:32:06 <TrueBrain> + locdi = set_global_6C91((unknown == 0) ? 2 : unknown) <- you know the name for locdi :D
12:33:08 <TrueBrain> set_global_6C91 <- can we keep the name something like: unknown_set_global_6C91
12:33:14 <TrueBrain> to keep the 'unknown' part there :D
12:33:37 <TrueBrain> so yeah, basically: it would be really awesome if you can clean up the patches a bit, so they integrate more with the rest :)
12:34:01 <TrueBrain> but in generally, you clearly start to understand what is going on :D Nice job :)
12:34:06 <TrueBrain> now I am back to my spherical coordinates :(
12:34:34 <Alberth> I considered 'set_global_6C91' fuzzy enough to imply 'unknown' :)
12:35:04 <TrueBrain> you would be surprised :)
12:35:09 <TrueBrain> we use scripts to scan for 'unknown'
12:35:16 <TrueBrain> it is hard to make it a fuzzy scan :D
12:35:31 <Alberth> thanks for the feedback, it helps in understanding what to work on.
12:36:09 <TrueBrain> basically we want as much emu_ gone as possible
12:36:15 <TrueBrain> just sometimes that is not yet possible
12:36:50 <TrueBrain> that is why we also made all those emu_ functions, as then only they contain emu_ shit
12:36:54 <TrueBrain> and the real C function can do without
12:38:34 <Alberth> Unfortunately, no spherical coordinates, just a lot of geometry
12:39:01 <TrueBrain> haha; what are you working on?
12:40:45 <Alberth> I still want to make a RCT1 clone, this is small step. On the other hand, making animations like in corsix-th would seem a nice goal too.
12:41:57 <Alberth> for the people that just tuned in, I was discussing (14:41:16) Alberth: for your enjoyment http://devs.openttd.org/~alberth/g.png my first rendered piece of rollercoaster track. It also contains many spheres although you don't see them :)
12:42:24 <TrueBrain> a real RCT1 clone, or just a based-on clone?
12:43:07 <Alberth> people around me seem to make a habit out of asking question I don't have an answer to :)
12:44:20 <Alberth> reverse engineering is an option, sure. Having a completely free game is however also interesting. The latter also gives you the opportunity to play with making animations
12:44:40 <Alberth> which can be useful for many cases
12:46:15 <Alberth> but just in case someone has plans, I have bought a 6CD pack of RCT1+extensions, RCT2+extensions, and a Anno1503 CD :)
12:47:44 *** glevans2 has joined #openDune
12:47:57 <Alberth> the amount of information about the files is disappointing though, mostly just about save game data
12:49:06 <TrueBrain> RCT1 is written in assembly
12:49:12 <TrueBrain> reverse engingeering that is a bitch :D
12:49:40 <Alberth> afaik it is created after TTDX
12:50:45 <TrueBrain> which was also assembly :D
12:50:54 <TrueBrain> still no clue how ludde did it
12:50:57 <TrueBrain> he never wanted to tell ...
12:51:29 <Alberth> so making a feel-alike clone may be the simpler approach here
12:52:00 <TrueBrain> you might try IDA on the source, see if he can decompile it a bit :)
12:52:15 <TrueBrain> my tools can't ... can't handle anything except 16bit real mode apps :D
12:52:52 <glx> it's probably protected against decompilation
12:53:25 <TrueBrain> as it is manually written, I don't know
12:53:32 * Alberth read that as "except real 16bit apps" :p
12:53:33 <TrueBrain> IDA can avoid most common pitfalls, but ...
12:54:11 <glx> manually you can add any tricks you want to prevent decompilation
12:55:10 <TrueBrain> then again, I think RCT is a game which should be rewritten from scratch
12:55:15 <TrueBrain> the details in the game are not important
12:55:31 <TrueBrain> (as they are kind-a too simplictic :D)
12:56:57 <TrueBrain> for a while now glx :)
12:57:28 <glx> worklist is outadated anyway ;)
12:57:45 <TrueBrain> I have to commit, yes :p
13:08:56 <Alberth> now let's see what mess I made last week :)
13:15:30 <Alberth> any preferred place for patches? I dump them in the channel now, but I can also throw them in the issue tracker if you like
14:10:24 <glx> well not so new but I didn't check the tracker too often
14:17:22 <glx> let's try to find when #58 started
14:28:53 <Alberth> glx: these are the times hg bisect is very useful :)
14:36:20 <glx> ok r1250 is ok, r1275 is always 100%
14:39:58 <glx> oh I start to know which function it is
14:40:05 <glx> and it's not a good thing
14:42:32 <glx> yup I know the broken function :(
14:42:53 <glx> it's the 1500 lines one in 1E04
14:43:19 <glx> r1254 is when always 100% started
14:46:01 <glx> for once it's not my fault ;)
14:50:36 <glx> but finding the bug will be hard
15:03:52 <glx> ok I found where the bug should be (but not exactly what the error is ;) )
15:10:30 <Alberth> Could you explain why if (emu_cs == 0x34DA) { overlay(0x34DA, 1); } is correct? I would expect != at first sight
15:11:52 <glx> if emu_cs = 0x3XXX it means the overlay has been unloaded
15:13:00 <glx> TrueBrain knows that stuff way better than me
15:13:58 <Alberth> I seem to be missing some crucial piece of hardware information :)
15:14:58 <glx> but at that time memory space was very limited
15:15:17 <Alberth> yeah I understand overlay as concept
15:15:45 <Alberth> just not that cs == some value to decide you want to load that overlay
15:19:21 <Alberth> oh, I just love those "goto next line" instructions :)
15:21:00 <glx> var = emu_ax; emu_ax = var; are nice too
15:22:16 <Alberth> you can never be careful enough :)
15:24:49 <glx> it's just the compiler output
15:26:42 <Alberth> yeah, stupid compiler. The authors really didn't care about good output.
15:27:52 <Alberth> or the game company forgot to turn on -O2 when compiling the production version :)
15:45:16 <glx> ok found the cause for always 100% in pre r1300 :)
15:45:46 <SmatZ> maybe it crashed with optimisations turned on :)
15:52:52 <DorpsGek> SVN: glx (r1436) -Fix (r1300, #58): >> 8 != / 8
15:53:17 <glx> yes we often add stupid bugs :)
15:56:47 <glx> and those are the hardest to spot
15:58:42 <TrueBrain> Alberth: the overlay stuff: first you do an overlay(0x3[45]??, 0);, before calling a function
15:58:48 <TrueBrain> 0 here is false, meaning not forcing a load
15:58:58 <TrueBrain> with that, it loads the overlay if it needs to be loaded, and then it can jump to the function
15:59:05 <TrueBrain> emu_cs and shit is set correctly, bladiebla
15:59:11 <TrueBrain> then it goes to funciton B[45]??
15:59:28 <TrueBrain> now when you return in an overlay, it might be that the overlay has unloaded the overlay (sillyness++)
15:59:33 <TrueBrain> so, it needs to be reloaded
15:59:39 <TrueBrain> on the stack then, the cs is 0x3[45]??
15:59:49 <TrueBrain> so .. == with some value, if that is the case, force a load of the overlay
15:59:55 <TrueBrain> it sets emu_cs correctly, etc etc
16:00:07 <TrueBrain> stricly, if you no longer use emu_cs in your C-ified funciton, you can remove this line
16:00:12 <TrueBrain> (and this is what we have been doing)
16:00:55 <TrueBrain> "introduces readable variable names including variable_3A" <- now the 3A arrises again? Lol :) I don't understand you with the 3A thingy :D
16:01:59 <TrueBrain> it is called variable_3A, because that is its position in Widget :D
16:02:12 <TrueBrain> so when ever that is named, the variable_16 can also be named :)
16:02:34 <TrueBrain> but naming it variable_3A is silly in this case, as it is not :3A of WidgetClickInfo :D
16:02:55 <Alberth> yeah, I dropped the rename
16:05:14 <Alberth> I think I have to write a Python script for these replacements :)
16:05:51 <TrueBrain> much of this can be scripted tbfh
16:05:59 <TrueBrain> if we did that before we started, we would have been much further
16:06:04 <TrueBrain> but ... then we had no clue what to do yet :D
16:08:06 <Alberth> and not only that, if you have write something generic that matches some fragment to replace it with another fragment, it gets terribly complicated, possibly to the point that just manual replacement is faster
16:11:10 <glx> dunno if #59 is our fault or in original
16:14:02 <Alberth> hmm, Mantiss is another program that uses 'press << to get to the next issue'
16:15:52 <TrueBrain> glx: I think it is a bug
16:15:59 <TrueBrain> seems unusual, haven't seen that before
16:23:56 <glx> it's a bug, in r1200 a carryall takes the harvester
16:43:27 <glx> xmin = max(Tile_GetPackedX(packed) - radius, mapInfo->minX);
16:43:28 <glx> xmax = max(Tile_GetPackedX(packed) + radius, mapInfo->minX + mapInfo->sizeX - 1);
16:43:28 <glx> ymin = max(Tile_GetPackedY(packed) - radius, mapInfo->minY);
16:43:28 <glx> ymax = min(Tile_GetPackedY(packed) + radius, mapInfo->minY + mapInfo->sizeY - 1);
16:43:37 <glx> something looks wrong there :)
16:47:17 <DorpsGek> SVN: glx (r1437) -Fix (r1264, #59): min != max
16:48:20 <TrueBrain> concrats on finding it so fast :D
16:48:42 <glx> with a test case it's always easier
16:53:02 <glx> ok no bugs left (except the unsolvable ones)
17:20:56 <glx> Alberth: Unknown_set_global_6C91(emu_get_memory16(emu_ss, emu_bp, 0x6)) <-- we keep emu_ wrappers for things like that
17:45:12 <glx> in cs__ files we keep emu_push() and others, using emu_ wrappers
17:46:28 <Alberth> oh, I am not allowed to call Unknown_set_global_6C91() ?
17:47:02 <glx> that way we can still use JIT when needed
17:47:37 <glx> you can but it's better not to, else JIT may revert it
17:49:28 <Alberth> so decompiled/* keeps the pushes, a parameter-less function-call, overlay reloading, stack removal, and pulling stuff from emu_ax?
17:50:56 <Alberth> in other words, just s/f__2598_0000_0017_EB80()/emu_set_global_6C91()/ and nothing else :)
17:51:31 <glx> well emu_Name_Of_The_Function
17:51:54 <glx> a wrapper around Name_Of_The_Function
17:52:52 <glx> and the wrapper requires @implements and other things in the comments
17:53:32 <glx> just check other wrappers
18:54:52 <Alberth> oh s/max/min/ I have looked at those lines for like 5 minutes and still could not see the problem :/
19:00:24 <TrueBrain> + Unknown_Set_Global_6C91(locdi); <- can you name locdi please :)
19:02:59 <glx> <Alberth> oh s/max/min/ I have looked at those lines for like 5 minutes and still could not see the problem :/ <-- don't worry it happens to me a lot :)
19:03:28 <TrueBrain> that is why we operate in a group :)
19:03:31 <TrueBrain> always one who spots it :)
20:15:16 <TrueBrain> where did I forget to press a button ..
20:15:53 <DorpsGek> SVN: truebrain (r1438) -Add: C-ified Unknown_Set_Global_6C91() (patch by Alberth)
20:18:28 <glx> isn't there a missing svn del ?
20:19:11 <glx> and don't forget the script ;)
20:19:50 <TrueBrain> strange, file is locally removed :)
20:19:53 <TrueBrain> I hate SVN patches :p
20:20:31 <DorpsGek> SVN: truebrain (r1439) -Fix (r1438): it helps if I do the right stuff :p
20:25:18 <Alberth> except it is not a SVN patch :)
20:27:02 <TrueBrain> I hate patches with SVN
20:28:37 <glx> hg doesn't magically remove files either
20:29:58 <glx> but it's strange no cs__2598 changes were in the previous commit
20:30:54 <Alberth> hmm, good point, perhaps we should blame patch :)
20:33:21 <Alberth> hmm, only compiled it
20:33:33 <TrueBrain> at least start a game when doing such changes :)
20:34:11 <glx> the unresolved jump is if (csip.csip == 0x0) return;
20:34:19 <glx> assert is not a good idea there
20:35:24 <glx> can be if (block == NULL) return; too
20:35:56 <glx> but definitely not an assert (dune2 tends to not check params before call)
20:36:23 <TrueBrain> can you apply his patch after these thingies glx? :)
20:36:40 <Alberth> first the program has to start again :)
20:40:08 <glx> where is decompiled.h change ?
20:45:16 <Alberth> weirdly enough the working copy I use for patch development does not run at all :(
20:45:16 <DorpsGek> SVN: glx (r1440) -Add: C-ified Sprites_Init_DataBlock()
20:45:33 <glx> oups I forgot to credit you
20:46:14 <Alberth> good, now they can blame you :)
20:46:40 <Alberth> well, enough today, good night all
20:46:57 <glx> night and thanks for your work
20:48:06 <Alberth> thanks for fixing those, although the game was not unplayable with them :)
continue to next day ⏵