gemot encubed  

Go Back   gemot encubed > Gemot > Technical Issues

Technical Issues For bug reports, problem solving, and help running Japanese software.

Reply
 
Thread Tools Display Modes
  #1  
Old 2005-10-23, 14:54
Roto
Guest
 
Posts: n/a
Default xclannad on Mac OS X

Between wanting to play things like the Tomoyo demo and the less expensive Standard Editions of Air and Kanon without having to start up Virtual PC and the fact that there's no RealLive interpreter for the Mac, I started messing around with trying to build xclannad on the Mac.

So far, I've got everything ported over into an XCode project, and after a lot of tweaking, it actually compiles.

Screenshot (Main menu)
Screenshot (Config)

It brings up the menus in CLANNAD and one can navigate through most of the menus without crashing. Color/transparency is obviously an issue (the Key logo is barely visible, and everything that's supposed to be transparent is appearing as yellow.) As soon as I click "New Game" it crashes. I've tried the Tomoyo demo as well, but it crashes on launch (not all that surprising.)

All of the sound stuff is disabled (Mac OS X handles audio significantly differently than Linux) and I've had to disable a few things like setting the window title and movie playback that were using features of SDL that are specific to X11.

My C++ is shaky, I've never programmed for X11 or SDL before, and I really don't know all that much about RealLive, so I'm kind of using the "tweak it until it works" approach here. It's more of an experiment than anything. Obviously, it's not usable at all, but it's a step in the right direction. I will post my XCode project if anyone is interested in working on it or playing around with it.

I was just curious whether anyone else has tried to get xclannad running under Mac OS X.

Last edited by Roto; 2007-10-11 at 11:20.
Reply With Quote
  #2  
Old 2005-10-23, 15:30
mr.aufziehvogel
Guest
 
Posts: n/a
Default

i can't tell for sure, but maybe these color errors are occuring because the powerpc processor of the mac's only work in big endian mode (while the x86 cpu's are working in little endian mode)
what kind of cpu do you have? g4 cpu's are supporting little and big endian but the G5 cpu's only work big endian.
Reply With Quote
  #3  
Old 2005-10-23, 15:43
Roto
Guest
 
Posts: n/a
Default

My processor is a G4.

So far from what I've seen, the code is fairly endian-independent. The code seems to suggest that it will run on sparc, and sparc is most definitely big endian.

I'll check out the graphics functions though and see if there might be somewhere that byte order is hard-coded.
Reply With Quote
  #4  
Old 2005-10-23, 16:09
Haeleth's Avatar
Haeleth Haeleth is offline
Ex-boss
 
Join Date: Mar 2003
Location: England
Posts: 2,106
Default

You probably want to apply some of my patches if you haven't done so already. In particular, "Read flags" is needed to run just about any game more recent than Clannad.

You will probably also find RLdev generally useful if you're planning to try to work on xclannad. Even if you daren't attempt to build it, it does include the only publicly available RealLive documentation I'm aware of.

Finally, bear in mind that xclannad is very incomplete, and in some places plain wrong, so don't necessarily expect its code to make much sense. (The implementation of the sprite/object system, for example, is clearly based on attempting to reproduce observations, rather than analysing the underlying system. I've tried once or twice to fix it, and every time backed down after realising that it would probably take a complete rewrite of the subsystem...) Good luck if you do decide to try to fix stuff, though. :/
Reply With Quote
  #5  
Old 2005-10-23, 16:57
Roto
Guest
 
Posts: n/a
Default

Yeah, I'm aware of the patches. I've tried them briefly, but thought it might be best to at least get it semi-working with Clannad first, at least until I understand RealLive a bit better to figure out what's going on. The patch I thought least likely to break Clannad was the operator precedence patch, but it breaks Clannad (it launches, but I get a black screen with the cursor and nothing else.)

I've been trying to build RLdev. I have all of the prerequisites listed in the INSTALL file, but keep hitting this error when I try to run omake:

Cannot find file /usr/local/lib/ocaml/site-lib/ulex/ulexing.cmxa

The contents of /usr/local/lib/ocaml/site-lib/ulex are:
META pa_ulex.cma ulex.cmi ulexing.cmi
cset.cmi pa_ulex.cmi ulexing.cma utf8.cmi

Any idea what the problem is/what I need to do differently when installing ulex?

Quote:
Finally, bear in mind that xclannad is very incomplete, and in some places plain wrong, so don't necessarily expect its code to make much sense.
I kind of gathered that from the xclannad page, your comments, and the source code... I suppose if I get really ambitious I'll get out my disassembler and take a close look at RealLive, but that's not likely to happen ;)
Reply With Quote
  #6  
Old 2005-10-24, 04:17
Haeleth's Avatar
Haeleth Haeleth is offline
Ex-boss
 
Join Date: Mar 2003
Location: England
Posts: 2,106
Default

Quote:
Originally Posted by Roto
The patch I thought least likely to break Clannad was the operator precedence patch, but it breaks Clannad (it launches, but I get a black screen with the cursor and nothing else.)
Oops. Yeah, I just tried that and got the same result. Er, I, uh, must have forgotten to test it again after Jagarl released 0.06... ehehe, I'll try and fix that... ;_;

Erm, also the online documentation is broken. The HTML manual in all the downloads has incorrect formatting that makes all the examples illegible. Use the version on the website instead. ;;_;;

Quote:
I've been trying to build RLdev.
Brave. Allow me to apologise for its rather esoteric composition.

Quote:
Any idea what the problem is/what I need to do differently when installing ulex?
ulex has a silly makefile where "make all" doesn't make all. You need to do "make all.opt" as well. That should sort it. (I'll add a note to INSTALL.)
Reply With Quote
  #7  
Old 2005-10-24, 07:10
Haeleth's Avatar
Haeleth Haeleth is offline
Ex-boss
 
Join Date: Mar 2003
Location: England
Posts: 2,106
Default

Update: I've fixed the precedence patch, and tested the lot; I can confirm that Clannad now works just as well with all my patches as without (proof).

As for your crashing upon starting the game... where are stdout and stderr going? xclannad prints a lot of diagnostics, which might give some hint as to exactly what's not working for you that works for me.
Reply With Quote
  #8  
Old 2005-10-24, 09:52
Roto
Guest
 
Posts: n/a
Default

Cool. Clannad's now getting to the menu with all patches installed.

On stdout, I'm not getting anything besides this:

Code:
Settings:
  Locale    : C
  Root Path : /Volumes/CLANNAD
  Font      : /cc.ttf
  CD-ROM    : /dev/cdrom
On stderr, I get a bunch of the command unsupported 0x23 errors that seem to correlate with fading something on the screen. At the time of the crash, SDL segfaults and xclannad exits with status 245.

stderr.txt

Attempting to launch the Tomoyo demo results in a segfault in SDL and an exit status of 246.

I got rldev to build (well, kprl and rlc anyway.) I've been having some trouble with xml-light and getting it installed in a manner that ocamlfind will actually find it, but I'm working on that...

Edit: I got xml-light installed with ocamlfind, but now I'm getting this error when I try to build vaconv:

Code:
Files image.cmx and /usr/local/lib/ocaml/site-lib/xml-light/xml-light.cmxa
make inconsistent assumptions over implementation Xml

Last edited by Roto; 2007-10-11 at 11:21. Reason: Updated URLs
Reply With Quote
  #9  
Old 2005-10-24, 11:35
Haeleth's Avatar
Haeleth Haeleth is offline
Ex-boss
 
Join Date: Mar 2003
Location: England
Posts: 2,106
Default

Re crashing: hmm, no very obvious cause.

The 0x23 errors are expected - you'll get one of those for every opcode xclannad fails to recognise, and there are thousands it doesn't know about. (0x23 is the byte that begins a command opcode in RealLive bytecode.)

Re xml-light: the "inconsistent assumptions over interface" thing normally happens when you have two files that were built with different versions of a library... did you manage to partially build vaconv before getting xml-light installed properly? If so, an "omake clean" in the vaconv directory might solve the problem.

It's probably not a big problem if you can't build vaconv, though; there are alternative bitmap convertors, like the one insani used on planetarian, which is written in C with no dependencies. Just reconfigure with "--no-vaconv --no-rlxml" if you find the hassle getting too much. ^_^
Reply With Quote
  #10  
Old 2005-10-24, 12:08
Roto
Guest
 
Posts: n/a
Default

The crash seems to be happening on line 1057 of scn2k_cmd.cc:

Code:
if (*d == 0x23) {
I gather that d is supposed to be pointing at the current location in the seen file in memory. (If I set a breakpoint there and launch the program, it's pointing at a location in memory that contains SEEN9030, as expected.) At some point it's getting pointed at a bad location and the segfault happens. I'm in the process of trying to figure out what causes that to happen.

I tried an omake clean, but still the same error building vaconv. I'll look into insani's converter. I just want to see what some of these graphics are to better understand what's going on and maybe provide some insight into the transparency problems.
Reply With Quote
  #11  
Old 2005-10-24, 13:12
zalas zalas is offline
 
 
Join Date: Feb 2004
Location: fushigi misuterii
Posts: 1,831
Send a message via ICQ to zalas
Default

Perhaps it is jumping to the wrong address? Is there some sort of indirect jump in RealLive, like for instance jumping to an address that is stored in a variable? I suspect perhaps that the variable was uninitialized from some previous code.

<offtopic>
I read omake as おまけ -.-;
</offtopic>
Reply With Quote
  #12  
Old 2005-10-24, 14:09
Roto
Guest
 
Posts: n/a
Default

Whatever it is, it's inconsistent. Sometimes I can get further into the game than others. Sometimes it crashes right after clicking New Game, sometimes it lets me get through the stuff with a white background, and I've gotten as far as partway through the sequence with the credits.

Is reallive.kfn the best reference for the bytecode? Or is there a better document somewhere to which I should be referring?

Edit: Every time before it crashes, the last command it executes is

Code:
 0x23 - cmd 00-01:000d:00[ 0]
Reply With Quote
  #13  
Old 2005-10-24, 14:40
Haeleth's Avatar
Haeleth Haeleth is offline
Ex-boss
 
Join Date: Mar 2003
Location: England
Posts: 2,106
Default

Quote:
Originally Posted by Roto
Is reallive.kfn the best reference for the bytecode? Or is there a better document somewhere to which I should be referring?
I'm afraid it's the best there is. There isn't a single document: the correspondence between bytecode and function names is defined in reallive.kfn, and their functionality is explained in the reference section of the manual. I never got round to combining the two. (But I will be quite happy to field any questions you can't dig out the answers to.)

Quote:
Originally Posted by zalas
Is there some sort of indirect jump in RealLive, like for instance jumping to an address that is stored in a variable?
Not in the bytecode itself. But the implementation probably uses all sorts of variables to store various addresses in, that could be getting clobbered or left uninitialised.

In this case, I have to say that, totally on a hunch, I suspect what's getting clobbered is the call stack; Clannad uses an awful lot of inter-SEEN jumps to display graphics and the like, so if there's a problem in the graphics code (as the bright yellow bits suggest), it seems quite plausible that that's what it's affecting.

One thing you could try would be applying this, which enables the debug printfs to log all SEEN changes - then check the stderr output to see if the segfaults tend to correlate closely with them.

(The patch also adjusts the opcode logging to display stuff in the same format as reallive.kfn and the actual internal RealLive debugger, which may be useful.)

Edit: didn't see your edit. That pretty much confirms my suspicion: the command you cite is <tt>rtl</tt>, the "return from global call" opcode.
Reply With Quote
  #14  
Old 2005-10-24, 16:36
Roto
Guest
 
Posts: n/a
Default

I appear to be looking for a heisenbug. It seems like the more carefully I try to step through the code in GDB, the less likely it is to crash. I'm guessing, then, that something is not getting initialized properly or something's writing to memory it's not supposed to. I guess it's time for me to learn the finer details of memory management in C++ and step through the relevant parts of the program in my head.

Stepping the program in the debugger, I managed to get quite a ways into the game (partway through the second day.) I only got the game to crash after I cleared my breakpoints and just held down the shift key to fly through it all.

This allowed me to see a bit more of the graphics problems. Some of the graphics formats used by RealLive seem to do fine... the PDT cursors and whatever is used by the CGs and backgrounds, for example. One of the formats seems to be resulting in the yellow pixels, and yet another seems to have the channels swapped (without carefully analyzing it, it looks like it's using red for alpha, and alpha, green, and blue for RGB (though not necessarily in that order.) I suspect that for that case at least, mr.aufziehvogel's assessment is spot on and it's got the byte order messed up.

This, of course, yields some results that are rather interesting as well as some that are downright scary!

Last edited by Roto; 2007-10-11 at 11:22. Reason: Updated URLs
Reply With Quote
  #15  
Old 2005-10-25, 05:13
Haeleth's Avatar
Haeleth Haeleth is offline
Ex-boss
 
Join Date: Mar 2003
Location: England
Posts: 2,106
Default

What happens if you modify G00CONV::Copy_32bpp in system/file.cc to reverse each 4 bytes as it copies them, instead of just using memcpy? SDL isn't something I know much about, but maybe it's dependent on programmers sorting out endianness for it.

Incidentally, the PDTs used for the cursor aren't working fine: they're coming out with their RGB channels reversed, judging by your screenshots. (The alpha channels seem to be fine for some reason, perhaps because they're stored separately.)

The CGs and backgrounds, on the other hand, do indeed seem to be working. Those are G00 format 0, which also happens to be the only purely 24-bit format used by RealLive, which may be significant (it forces xclannad to load it pixel by pixel instead of copying whole blocks).
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may post new threads
You may post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help with compiling xclannad for Windows Mobile Zer0_byt3 Technical Issues 5 2011-06-28 05:03
Narcissu 2 on mac? Ayato General Discussion 114 2010-05-31 11:02
Tsukihime on Mac OS X vampiresaru General Discussion 2 2007-01-25 16:28
new xclannad is released jagarl Technical Issues 8 2006-08-25 13:10
Helping with xclannad (can't think of anywhere else to go..) Shish Technical Issues 28 2005-04-15 08:55


All times are GMT -8. The time now is 21:51.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2020, vBulletin Solutions, Inc.