gemot encubed  

Go Back   gemot encubed > Gemot > Technical Issues

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

Closed Thread
Thread Tools Display Modes
Old 2005-03-31, 18:43
Posts: n/a
Default Kanon on Mac OS X & Music Issues

I can't seem to get the music to work on Mac OS X. With the version of Kurokoge listed on the download page, the game seems to run relatively well, but I don't get any of the music from the CD. If I download the Japanese binary of Kurokoge, the music works fine, but the text in the game has alignment problems. Downloading the source for the Japanese version and building it myself also results in a game without music.

Any suggestions? I'm running Mac OS 10.3.8 with the adult version of the game.

Edit: I'm guessing that it has something to do with the fact that iTunes is re-naming the files with the names of the tracks from the CDDB, and that Kurokoge is looking for them to be called "Track 02" or similar. Unfortunately, the fact that I can't read Japanese makes it hard for me to decipher the comments in the source code...

Edit, again: It looks like there's some information on this on the Kurokoge page, specifically note number 5. I'm having about as much luck deciphering Google's translation as I would have had trying to read it in Japanese, though. If anyone could tell me what that says, I would appreciate it greatly. :)

(Note number 5 on this page: )
Old 2005-04-01, 01:28
Haeleth's Avatar
Haeleth Haeleth is offline
Join Date: Mar 2003
Location: England
Posts: 2,106

Note 5 suggests ripping the music from the CD to MP3 files and putting them in the game directory with Kurokoge. It says you can use several different methods for naming the files: you should be able to see what it's suggesting there without needing to read Japanese. ;)

If that doesn't work I'll take a look at the music code and see if I can figure out what the problem is...
Old 2005-04-01, 10:46
Posts: n/a

Thanks... I figured it was saying something like that, so I tried it, and still no music. I also tried the .aiff files straight from the CD copied into the game directory and had no luck with that, either. I also tried the files in the DAT folder, still with no luck.

I've also noticed that the voice patch files that I have installed do not play with the newer Kurokoge either. Sound effects, however, work fine (doors closing, footsteps, etc.)

Looking more closely at the Kurokoge site, I see that the binary version I downloaded (which plays the soundtrack and the voice files just fine) is the one at the very top of the page: the CodeWarrior version. I'm suspecting that something was changed in between the CodeWarrior and the Xcode versions (or it just compiles differently with gcc) that breaks some of the audio stuff.

Okay, I just did some experimenting with the CD out of my drive. The Japanese CodeWarrior binary plays the .aiff files that I imported into the game folder, but the Xcode version still does not (and still won't play voice files, either.) So it's not just reading the audio CD that's causing problems.

And here's another observation that may or may not be relevant. The first version of Kurokoge I downloaded was the patched English version, from this site. I couldn't get it to start (the window would show up briefly and then it would quit.) That's what led me to download the Japanese version, which opened fine, played the music, etc, but has problems with the dialogue. After having started the Japanese version once, the English version launches fine. Through experimentation, I found that it needs a ????.plist file [note: that should be 'kurokoge' in hiragana, but my browser/phpbb isn't behaving] with a font setting in it in the preferences folder, or it won't start. Launching the Japanese version creates this file with the necessary setting. Since the font setting isn't getting properly added to the preferences with the patched English version, is it possible that there is some other preference setting that the new version needs to play the soundtrack and voice files properly? Here is my ????.plist file:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "">
<plist version="1.0">
		<string>Track %02d</string>
		<string>Track %02d.aiff</string>
		<string>Track %02d.mp3</string>
		<string>�g���b�N %02d</string>
		<string>�g���b�N %02d.mp3</string>
Thanks for any help you can offer. I'm slowly picking my way through the source code trying to find an answer to this, but for me it might as well be uncommented and C++ and the Carbon framework isn't a language I'm particularly familiar with either...
Old 2005-04-01, 13:42
Posts: n/a

I think I've figured out what's going on. The CodeWarrior version builds as a single file executable (Mac OS 9-style) whereas the Xcode version builds as a Mac OS X bundle (meaning that the actual executable file is inside of ). As a result, it's guessing the game directory is ~/Kanon/ rather than ~/Kanon/. Obviously this has been compensated for in parts of the source, otherwise the game would not run at all (it wouldn't find gameexe.ini). However, it doesn't compensate for this in looking for the music files. I tested this out by putting the track files in the Contents/MacOS/ directory and sure enough, the music plays.

So, I have a temporary fix for the music, but it doesn't work for the voice files. I tried both aliasing and symlinking the DAT directory into the Contents/MacOS/ folder, but that didn't help. I just need to find where in the source the paths to the voice and music files are determined and fix it there.

I'm slowly working my way through the code, but if someone who's worked with it before can point me in the right direction to look, it might save me a little time...

Old 2005-04-01, 13:50
Haeleth's Avatar
Haeleth Haeleth is offline
Join Date: Mar 2003
Location: England
Posts: 2,106

Now that's the kind of bug report I like. Detailed and containing the solution. ;)

I'm out of town this weekend, so I can't look through the code myself, but I'll be able to get on it probably Monday or Tuesday if you're still looking at that point.
Old 2005-04-01, 16:54
Posts: n/a

Well, I've been messing with the code for a while and haven't really gotten anywhere (well, I guess I've learned a bit about C++ and a bit about AVG32...)

For now, I'm able to play the game with music by placing aliases to the files in the Contents/MacOS folder. That's really a workaround rather than a fix, but it works.

I'm at a loss for why the voice files aren't playing. They're called with the same opcode as the sound effects [$30] (which do work.) The only difference is that they are in a directory inside of the DAT directory, whereas the sound effects are just loose in DAT. Here are a few possibilities I can come up with:

OS X uses "/" as its directory separator. Classic Mac OS uses ":". The AVG uses the Windows "\". On line 402 of soundmgr.cpp, the backslashes are converted to colons. This may or may not need to be changed to a forward slash to work on OS X; changing it still doesn't fix it. (So it may be part of the solution, but it's definitely not the only thing.)

OS X is somewhat case-sensitive in terms of file names; it may not like the fact that the files are named with a lowercase .wav and the source is using a capitalized WAV. I tried renaming a few of the files, but that still didn't help.

Since I really don't understand how Carbon handles files very well at all, nor do I really follow the intricacies of C++ syntax, it's becoming an exercise in frustration.

I'll probably keep trying things for a while, but I don't really hope to get anywhere. Hopefully what I've found out thusfar will be helpful to someone who actually knows what's going on ;)
Old 2005-04-09, 22:27
Posts: n/a

Well, after a week of not looking at the code and coming back to it, I'm onto something. I have determined the reason for the voice sounds not playing.

The AVG bytecode refers to the file (in this case, Nayuki's "Yuki?") as 0\0000. Kurokoge replaces the backslash (path separator on Windows) with a colon, and adds the .WAV to the end. The resulting partial path gets passed to FileReference::Find, which uses FSMakeFSRefUnicode to get an FSRef to the file. FSRef returns a fnfErr (File Not Found Error).

The reason for this is clearly outlined in Apple's docs for FSMakeFSRefUnicode:

The name must be a leaf name; partial or full pathnames are not allowed. If you have a partial or full pathname in Unicode, you will have to parse it yourself and make multiple calls to FSMakeFSRefUnicode.
Since it's being passed a partial path, it doesn't work.

This explains why the game's sound effects work but the voice files don't: the sound effects are located out in the DAT directory, while the voice files are inside numbered folders inside the DAT directory and are referred with a partial path in the bytecode.

Unfortunately, as I've mentioned before, my C++ is not good enough to be able to figure out how to parse the path name into its individual parts (especially because it's working with UniStrings instead of plain c strings) and make a call on FileReference::Find for each part of the path.

If someone who knows something about the Carbon File Manager and C++ could write me a fragment of code (which should be relatively simple) or even take a look at the appropriate lines in FileReference.cpp I would be really happy.
Old 2005-04-09, 23:54
Posts: n/a

First off, apologies for replying to myself twice in a row.

I am way too stubborn for my own good.

I dug out my copy of K&R and figured out a way to kluge together a really messy solution, but it actually works. I made my changes in soundmgr.cpp, where the file is still referenced as a char array rather than a UniString (char arrays I can deal with, UniStrings throw me for a loop...)

I'll post my code if you want it, but someone should really fix this in its proper place (in FileReference.cpp) and make it compatible with paths more than one level deep.

For now, though, I've got a copy of Kurokoge that actually plays the voice files, plays the music (once the files are aliased into Contents/MacOS) and displays text correctly! Sure, it's practically held together with duct tape, but it works.

I hope the information that I've reported in this thread will be helpful when someone who actually knows what they're doing can take a look at it.
Old 2005-04-10, 02:30
Haeleth's Avatar
Haeleth Haeleth is offline
Join Date: Mar 2003
Location: England
Posts: 2,106

Do you think you could send me a copy of your changes? At the very least it would save me a little time working out which bits to look at...
Old 2005-04-10, 11:52
Posts: n/a


Here's the output of diff on soundmgr.cpp.

<     int i;
> 	char *dirname = new char[256];
> 	char *fname = new char[256];
<         /* 音声化パッ�対策 */
<         for(i = 0; *(f+i); i++)
<         {
<             if(*(f+i) == '\\') *(f+i) = ':';	// f[] 内�'¥'を':'�置�
<         }
<         /* ���� */
< 		// ファイル�リファレンス
< 		FileRefPtr WAVEFile;
> 		// break up the file name at the backslash, if it has one
> 		dirname = strtok( f, "\\" );
> 		fname = strtok( NULL, "\\" );
< 		sprintf( file, "%s.WAV", f );
< 		WAVEFile = FileReference::Find( ini->wavdir, file );
> 		FileRefPtr WAVEFile;
> 		FileRefPtr WAVEDir;  // new var to store the directory the file's in
> 		// if fname's not null, it means there were at least two parts to the
> 		// pathname.  The second one is assumed to be the file (i.e. this won't
> 		// work for paths more than one directory deep)
> 		if( fname != NULL ) {
> 			sprintf( file, "%s.WAV", fname );
> 			WAVEDir = FileReference::Find(ini->wavdir, dirname);
> 			WAVEFile = FileReference::Find( file, WAVEDir->GetFSRefPtr()  );
> 		} else {
> 			sprintf( file, "%s.WAV", f );
> 			WAVEFile = FileReference::Find( ini->wavdir, file );
> 		}
> 		// do the same thing for .MP3 and .WAV.MP3 until we get a valid file
< 			sprintf( file, "%s.MP3", f );
< 			WAVEFile = FileReference::Find( ini->wavdir, file );
> 			if( fname != NULL ) {
> 				sprintf( file, "%s.MP3", fname );
> 				WAVEDir = FileReference::Find(ini->wavdir, dirname);
> 				WAVEFile = FileReference::Find( file, WAVEDir->GetFSRefPtr()  );
> 			} else {
> 				sprintf( file, "%s.MP3", f );
> 				WAVEFile = FileReference::Find( ini->wavdir, file );
> 			}
< 				sprintf( file, "%s.WAV.MP3", f );
< 				WAVEFile = FileReference::Find( ini->wavdir, file );
> 				if( fname != NULL ) {
> 					sprintf( file, "%s.WAV.MP3", fname );
> 					WAVEDir = FileReference::Find(ini->wavdir, dirname);
> 					WAVEFile = FileReference::Find( file, WAVEDir->GetFSRefPtr()  );
> 				} else {
> 					sprintf( file, "%s.WAV.MP3", f );
> 					WAVEFile = FileReference::Find( ini->wavdir, file );
> 				}
Closed Thread

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
Kanon or Clannad on Mac OSX prnoct90 Technical Issues 2 2009-02-03 12:09
Pocket Kanon & AIR(Plus, a greetings and a question.) F.I.A General Discussion 3 2006-02-12 19:14
kanon music neo-kun General Discussion 9 2005-03-05 03:29
Kanon and Linux, fonts and encoding issues naa Technical Issues 6 2004-09-28 01:34
Possible music issues kupo Technical Issues 5 2004-09-10 18:35

All times are GMT -8. The time now is 01:31.

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