Understated Ur-Drakon Celtic Minstrel Posted December 16, 2007 Posted December 16, 2007 Okay, I'm trying to compile the BoE source code on a Mac. It compiles*, links, and runs, but instantly exits with status 1. (One time it was status 5.) There isn't even a chance to debug to find where the problem is. It's almost like it has an error before it even gets to main(). Does anyone know how I can get it to run? *Except the scenario editor, which is missing a constant. This should be easy to fix. Also, is there any simple way to get rid of the tons of "deprecated" warnings? Or is the only solution to hunt through the documentation? Or... is it simply because Carbon is being phased out? (At least I thought it was...) Quote
Well-Actually War Trall Niemand Posted December 16, 2007 Posted December 16, 2007 Which copy of the source code were you using? EDIT: Carbon is not being phased out, but Quickdraw most certainly is. In XCode you should be able to turn those warnings off by going to the project build settings and unchecking the 'Warn About Deprecated Functions' item. Quote
Well-Actually War Trall Khoth Posted December 16, 2007 Posted December 16, 2007 I'd guess that the resource files are being mangled/not found/something. You can get the resources here: http://khoth.ath.cx/~khoth/Resources.zip If you put them in the directory the program is made in (build/{Debug,Release}/), then it might work. Quote
Understated Ur-Drakon Celtic Minstrel Posted December 16, 2007 Author Posted December 16, 2007 Thanks, it was that the resource files were not where they were expected to be. Now, can someone explain this: "\p::::bladesofexile.rsrc" I know \p is the length byte, but why are there so many colons? Edit: Oh, I'm using Khoth's source. Not the OBoE source, just the BoE source. And thanks, Niemand, for the tip. Quote
Well-Actually War Trall Khoth Posted December 17, 2007 Posted December 17, 2007 The colons are to back out of directories. It starts by looking in the same directory as the executable file, but since that's "Blades of Exile.app/Contents/MacOS/", inside the bundle, it's kind of an inconvenient place to put them, so it's easier to go out and look in the same directory as the bundle. Quote
Understated Ur-Drakon Celtic Minstrel Posted December 17, 2007 Author Posted December 17, 2007 I can't quite seem to figure out how those paths work. At least, "\p::Resources:bladesofexile.rsrc" fails even though the file exists in the Resources folder within the bundle. It fails with one or three trailing colons, too. Anyway, I increased the maximum number of scenarios listed in the Choose Scenario dialog to 50, as well as omitting the default three from said listing. The hardest part was finding where to apply the changes. Edit: I also put this number into a constant (kMaxScenarios) to make it easier to change. Edit: If I obtained the source using "darcs get", can I also use darcs to add my changes? Quote
Well-Actually War Trall Khoth Posted December 17, 2007 Posted December 17, 2007 Using darcs to record your changes: "darcs record *.c *.h" will make it ask about your changes one by one. The changes you say yes to will be recorded into a patch. (If you don't specify the *.c *.h, then it'll ask about changes in the .xcode part, which are generally pointless) To get the patch to me, do "darcs send -o somefilename", say yes when it asks about your patch, then email me somefilename as an attachment. (darcs send with no arguments will try to email it, but gmail rejects emails from random people's computers). Quote
Understated Ur-Drakon Celtic Minstrel Posted December 18, 2007 Author Posted December 18, 2007 Is there any way to determine which bit of code is causing it to exit with status code 1? Or, for that matter, any other status code. (I'm working on the PC editor, by the way.) Quote
Well-Actually War Trall Khoth Posted December 18, 2007 Posted December 18, 2007 Running it in the debugger sounds like your best bet, but if it's not even getting that far, I'm not sure what you can do. Quote
Understated Ur-Drakon Celtic Minstrel Posted December 19, 2007 Author Posted December 19, 2007 I guess I'll have to look through the entire code. (Edit: Or maybe there's am error in the settings...) Does ExitToShell() give status code 1? If yes, does anything else give the same status code? Edit 2: Start with Performance Tool -> MallocDebug makes slight progress - instead of exiting with status 1, it quits unexpectedly. I'm not sure I'll be able to decipher the crash report to find out why, though. Quote
Well-Actually War Trall Niemand Posted December 19, 2007 Posted December 19, 2007 I would recommend running with the debugger and stepping through the startup functions to find out where it exits. Furthermore, if you use the debugger even if you don't set any breakpoints, the debugger may catch where it goes wrong or crashes and show you what it was doing at that moment. And by all means, show us the crash report; these are almost alawys more helpful than most people give them credit for. EDIT: I just want to comment that I'm not impressed at all by my first experiences with darcs. The command you recommend on your website Khoth? That made it download the BoE source. . . to the trash. I'm just going to assume that that was an odd fluke. Quote
Understated Ur-Drakon Celtic Minstrel Posted December 19, 2007 Author Posted December 19, 2007 The trouble is, even if I set a breakpoint at the top of main, it doesn't pause there so I can step through. Anyway, here 's the crash report. Quote
Well-Actually War Trall Niemand Posted December 19, 2007 Posted December 19, 2007 Um, are you running this under Rosetta? I've never worked with Rosetta, but all of the "PPC (translated)" and so forth looks like it could well be. Let's see if we can turn this into a Universal Binary, shall we? Although I still can't get my copy to load its resources properly, I had no trouble building it after I used the following settings: Code: SDKROOT = /Developer/SDKs/MacOSX10.4u.sdkMACOSX_DEPLOYMENT_TARGET_i386 = 10.4MACOSX_DEPLOYMENT_TARGET_ppc = 10.3SDKROOT_i386 = /Developer/SDKs/MacOSX10.4u.sdkSDKROOT_ppc = /Developer/SDks/MacOSX10.3.9.sdk (You can copy this block, go to XCode's project settings, select a line and hit paste, it should sort the pasted data out nicely into seperate items.)See if this helps any (or works, my machine is PPC, so I have to guess at getting intel stuff to work). I would guess that you can't debug applications running under Rosetta because the application itself isn't really running; what's running is Rosetta interpreting the application's code. Quote
Understated Ur-Drakon Celtic Minstrel Posted December 19, 2007 Author Posted December 19, 2007 Well, that doesn't seem to work. The crash no longer occurs, but I still can't debug it. Edit: Never mind, I just forgot to add a breakpoint. Debugging works now. Quote: Originally written by Khoth: Using darcs to record your changes: "darcs record *.c *.h" will make it ask about your changes one by one. The changes you say yes to will be recorded into a patch. (If you don't specify the *.c *.h, then it'll ask about changes in the .xcode part, which are generally pointless) To get the patch to me, do "darcs send -o somefilename", say yes when it asks about your patch, then email me somefilename as an attachment. I tried to do this, but I don't think it worked properly. The "patch" seems to be almost the entire file that I added a few lines to, without my added lines, and with a hyphen in front of each line. Shouldn't there be a plus in front of some lines? Quote
Understated Ur-Drakon Celtic Minstrel Posted December 24, 2007 Author Posted December 24, 2007 Progress! The character editor now loads its main resource file, but it's now having problems creating a new GWorld (QuickDraw error -50). I haven't figured out what the error means yet. Quote
Understated Ur-Drakon Celtic Minstrel Posted December 24, 2007 Author Posted December 24, 2007 (sorry about the triple post) I think the following chunk of code is somehow to blame for the PC editor currently not working. Code: current_pic_handle = GetPicture (picture_to_get); if (current_pic_handle == NIL) { SysBeep(2);SysBeep(50);SysBeep(50); ExitToShell();} pic_rect = ( **( current_pic_handle) ).picFrame; pic_wd = pic_rect.right - pic_rect.left; pic_hgt = pic_rect.bottom - pic_rect.top; GetGWorld (&origPort, &origDev); check_error = NewGWorld (&myGWorld, 0, &pic_rect, NULL, NULL, 0); The odd thing is that for PICT ID 5000, which has a width of 380 pixels and a height of 70 pixels, pic_rect is set to (t=3072, l=2560, b=20992, r=-31231). I don't understand why it doesn't work. The error occurs at the NewGWorld; it returns -50 which is a paramErr (illegal parameter), and I suspect it is because the rect is bad. Quote
Chittering Clawbug King InuYasha Posted December 25, 2007 Posted December 25, 2007 While what I am doing does not use the Mac sources (as I have only a little idea on how Windows sources work, much less Mac ones...), I have figured out a way to determine which parts of Blades of Exile need porting from Win16 to Win32. Simply put, Winelib can parse the sources and attempt to build them. Winelib does not suppport anything the Win32 API does not support, and thus the parts of the Win16 API dropped from the Win32 API are given back as errors, stopping the build. BoE game source: Code: wineg++ -c -mno-cygwin -I. -o actions.o actions.cppglobal.h:447: error: expected unqualified-id before ‘short’global.h:447: error: expected `)' before ‘short’global.h:447: error: expected `)' before ‘short’global.h:447: error: expected `)' before ‘short’global.h:448: error: expected unqualified-id before ‘short’global.h:448: error: expected `)' before ‘short’global.h:448: error: expected `)' before ‘short’global.h:448: error: expected `)' before ‘short’graphutl.h:3: error: expected ‘,’ or ‘...’ before ‘*’ tokengraphutl.h:4: error: expected ‘,’ or ‘...’ before ‘*’ tokengraphutl.h:6: error: expected ‘,’ or ‘...’ before ‘*’ tokengraphutl.h:7: error: expected initializer before ‘*’ tokengraphutl.h:10: error: expected ‘,’ or ‘...’ before ‘*’ tokenactions.cpp: In function ‘void check_cd_event(HWND__*, UINT, UINT, LONG)’:actions.cpp:1511: error: ‘MAKEPOINT’ was not declared in this scopeactions.cpp: In function ‘void flash_rect(RECT)’:actions.cpp:1571: error: ‘SetViewportOrg’ was not declared in this scopeactions.cpp: In function ‘void flash_round_rect(RECT, short int)’:actions.cpp:1603: error: ‘SetViewportOrg’ was not declared in this scopeactions.cpp: In function ‘Boolean handle_keystroke(UINT, LONG)’:actions.cpp:1829: error: ‘GFSR_USERRESOURCES’ was not declared in this scopeactions.cpp:1829: error: ‘GetFreeSystemResources’ was not declared in this scopeactions.cpp:1832: error: ‘GFSR_GDIRESOURCES’ was not declared in this scopewinegcc: g++ failedmake: *** [actions.o] Error 2 PC editor: Code: wineg++ -c -mno-cygwin -I. -o bladpced.o bladpced.cppglobal.h:447: error: expected unqualified-id before ‘short’global.h:447: error: expected `)' before ‘short’global.h:447: error: expected `)' before ‘short’global.h:447: error: expected `)' before ‘short’global.h:448: error: expected unqualified-id before ‘short’global.h:448: error: expected `)' before ‘short’global.h:448: error: expected `)' before ‘short’global.h:448: error: expected `)' before ‘short’graphutl.h:1: error: expected ‘,’ or ‘...’ before ‘*’ tokengraphutl.h:2: error: expected ‘,’ or ‘...’ before ‘*’ tokengraphutl.h:5: error: expected ‘,’ or ‘...’ before ‘*’ tokengraphutl.h:6: error: expected ‘,’ or ‘...’ before ‘*’ tokengraphutl.h:7: error: expected ‘,’ or ‘...’ before ‘*’ tokengraphutl.h:8: error: expected initializer before ‘*’ tokenbladpced.cpp:171: error: ‘_export’ does not name a typebladpced.cpp:174: warning: ‘__stdcall__’ attribute only applies to function typesbladpced.cpp:174: error: ‘int WinMain’ redeclared as different kind of symbol/usr/include/wine/windows/winbase.h:2386: error: previous declaration of ‘int WinMain(HINSTANCE__*, HINSTANCE__*, CHAR*, int)’bladpced.cpp:174: error: ‘hInstance’ was not declared in this scopebladpced.cpp:174: error: ‘hPrevInstance’ was not declared in this scopebladpced.cpp:175: error: ‘lpszCmdParam’ was not declared in this scopebladpced.cpp:175: error: ‘nCmdShow’ was not declared in this scopebladpced.cpp:180: error: expected unqualified-id before ‘{’ tokenwinegcc: g++ failedmake: *** [bladpced.o] Error 2 Scenario Editor: Code: wineg++ -c -mno-cygwin -I. -o blscened.o blscened.cppglobal.h:352: error: expected unqualified-id before ‘short’global.h:352: error: expected `)' before ‘short’global.h:352: error: expected `)' before ‘short’global.h:352: error: expected `)' before ‘short’global.h:353: error: expected unqualified-id before ‘short’global.h:353: error: expected `)' before ‘short’global.h:353: error: expected `)' before ‘short’global.h:353: error: expected `)' before ‘short’tfileio.h:9: error: variable or field ‘make_new_scenario’ declared voidtfileio.h:9: error: ‘Str255’ was not declared in this scopetfileio.h:9: error: expected primary-expression before ‘short’tfileio.h:9: error: expected primary-expression before ‘short’tfileio.h:9: error: expected primary-expression before ‘short’tfileio.h:10: error: expected primary-expression before ‘short’tfileio.h:10: error: initializer expression list treated as compound expressiontfileio.h:36: error: variable or field ‘flip_rect’ declared voidtfileio.h:36: error: ‘Rect’ was not declared in this scopetfileio.h:36: error: ‘s’ was not declared in this scopegraphutl.h:3: error: expected ‘,’ or ‘...’ before ‘*’ tokengraphutl.h:4: error: expected ‘,’ or ‘...’ before ‘*’ tokengraphutl.h:6: error: expected ‘,’ or ‘...’ before ‘*’ tokengraphutl.h:7: error: expected initializer before ‘*’ tokengraphutl.h:10: error: expected ‘,’ or ‘...’ before ‘*’ tokenblscened.cpp:154: error: ‘_export’ does not name a typeblscened.cpp:157: warning: ‘__stdcall__’ attribute only applies to function typesblscened.cpp:157: error: ‘int WinMain’ redeclared as different kind of symbol/usr/include/wine/windows/winbase.h:2386: error: previous declaration of ‘int WinMain(HINSTANCE__*, HINSTANCE__*, CHAR*, int)’blscened.cpp:157: error: ‘hInstance’ was not declared in this scopeblscened.cpp:157: error: ‘hPrevInstance’ was not declared in this scopeblscened.cpp:158: error: ‘lpszCmdParam’ was not declared in this scopeblscened.cpp:158: error: ‘nCmdShow’ was not declared in this scopeblscened.cpp:163: error: expected unqualified-id before ‘{’ tokenwinegcc: g++ failedmake: *** [blscened.o] Error 2 I would have preferred -Wall switch enabled, but that's too much pain at once.... Apparently, the code is C++, here I thought it was C when i glanced at the Mac vs Win16 sources and saw how similar they were... Hey, at least it's progress... These files are being built using autogenerated makefiles from Winemaker. By no means is Winelib a substitute for a genuine native port to Linux. It is merely a stopgap development measure. Note: Pushed fix in filename to Mercurial repository.... Quote
Well-Actually War Trall Niemand Posted December 26, 2007 Posted December 26, 2007 Quote: The odd thing is that for PICT ID 5000, which has a width of 380 pixels and a height of 70 pixels, pic_rect is set to (t=3072, l=2560, b=20992, r=-31231). I don't understand why it doesn't work. The error occurs at the NewGWorld; it returns -50 which is a paramErr (illegal parameter), and I suspect it is because the rect is bad. I bet I know why! See this thread . Quote
Understated Ur-Drakon Celtic Minstrel Posted December 26, 2007 Author Posted December 26, 2007 Do you mean this? Code: check_error = NewGWorld (&myGWorld, 0, &pic_rect, NULL, GetGDevice(), noNewDevice + kNativeEndianPixMap); It sounds like the right solution, yet it still doesn't work. I had actually thought it was a problem from GetPicture which wasn't caught until the NewGWorld call. This also doesn't work if I put NULL instead of GetGDevice() and omit noNewDevice. It doesn't even work if I specify the bit depth in the second argument. Quote
Well-Actually War Trall Niemand Posted December 26, 2007 Posted December 26, 2007 Hm. Are you getting the picture's rectangle using the function that Jeff suggests in the other thread? Quote
Understated Ur-Drakon Celtic Minstrel Posted December 26, 2007 Author Posted December 26, 2007 Hmm. You must mean this: Code: QDGetPictureBounds( current_pic_handle, &pic_rect); instead of this: Code: pic_rect = ( **( current_pic_handle) ).picFrame; Thanks, that problem seems to have been overcome. The window is still not drawn though. I'm about to see if I can locate the reason. Edit: Well, it launches perfectly, and the menus work, but the window does not display. Quote
Chittering Clawbug King InuYasha Posted December 27, 2007 Posted December 27, 2007 Yay! I feel somewhat happy! As simple as it is, it still means I managed to actually port some code! Edit: http://hg.sharesource.org/oboecross32/ *Dances a little, then realizes big problem* OH SNAP! There is a Mac codebase file in the Windows codebase... "./ScenEd/townout.cpp" is the Mac Scenario Editor codebase file "townout.c" Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.