Trying to Compile from Source

Error message

Deprecated function: implode(): Passing glue string after array is deprecated. Swap the parameters in drupal_get_feeds() (line 394 of /var/www/pied-piper.ermarian.net/includes/common.inc).
AuthorTopic: Trying to Compile from Source
Shock Trooper
Member # 10488
Profile #0
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...)

[ Sunday, December 16, 2007 11:28: Message edited by: Celtic Minstrel ]
Posts: 334 | Registered: Friday, September 14 2007 07:00
Infiltrator
Member # 5576
Profile Homepage #1
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.

[ Sunday, December 16, 2007 13:18: Message edited by: Niemand ]

--------------------
Überraschung des Dosenöffners!
"On guard, you musty sofa!"
Posts: 627 | Registered: Monday, March 7 2005 08:00
Post Navel Trauma ^_^
Member # 67
Profile Homepage #2
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.

--------------------
Barcoorah: I even did it to a big dorset ram.

New Mac BoE
Posts: 1798 | Registered: Thursday, October 4 2001 07:00
Shock Trooper
Member # 10488
Profile #3
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.

[ Sunday, December 16, 2007 14:04: Message edited by: Celtic Minstrel ]
Posts: 334 | Registered: Friday, September 14 2007 07:00
Post Navel Trauma ^_^
Member # 67
Profile Homepage #4
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.

--------------------
Barcoorah: I even did it to a big dorset ram.

New Mac BoE
Posts: 1798 | Registered: Thursday, October 4 2001 07:00
Shock Trooper
Member # 10488
Profile #5
:/ 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. :rolleyes:

Edit: I also put this number into a constant (kMaxScenarios) to make it easier to change.

[ Monday, December 17, 2007 07:16: Message edited by: Celtic Minstrel ]
Posts: 334 | Registered: Friday, September 14 2007 07:00
Post Navel Trauma ^_^
Member # 67
Profile Homepage #6
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).

--------------------
Barcoorah: I even did it to a big dorset ram.

New Mac BoE
Posts: 1798 | Registered: Thursday, October 4 2001 07:00
Shock Trooper
Member # 10488
Profile #7
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.)
Posts: 334 | Registered: Friday, September 14 2007 07:00
Post Navel Trauma ^_^
Member # 67
Profile Homepage #8
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.

--------------------
Barcoorah: I even did it to a big dorset ram.

New Mac BoE
Posts: 1798 | Registered: Thursday, October 4 2001 07:00
Shock Trooper
Member # 10488
Profile #9
I guess I'll have to look through the entire code. :rolleyes: (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.

[ Tuesday, December 18, 2007 18:23: Message edited by: Celtic Minstrel ]
Posts: 334 | Registered: Friday, September 14 2007 07:00
Infiltrator
Member # 5576
Profile Homepage #10
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.

--------------------
Überraschung des Dosenöffners!
"On guard, you musty sofa!"
Posts: 627 | Registered: Monday, March 7 2005 08:00
Shock Trooper
Member # 10488
Profile #11
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.
Posts: 334 | Registered: Friday, September 14 2007 07:00
Infiltrator
Member # 5576
Profile Homepage #12
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:
SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk
MACOSX_DEPLOYMENT_TARGET_i386 = 10.4
MACOSX_DEPLOYMENT_TARGET_ppc = 10.3
SDKROOT_i386 = /Developer/SDKs/MacOSX10.4u.sdk
SDKROOT_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.

--------------------
Überraschung des Dosenöffners!
"On guard, you musty sofa!"
Posts: 627 | Registered: Monday, March 7 2005 08:00
Shock Trooper
Member # 10488
Profile #13
Well, that doesn't seem to work. The crash no longer occurs, but I still can't debug it. :/

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?
Posts: 334 | Registered: Friday, September 14 2007 07:00
Shock Trooper
Member # 10488
Profile #14
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.

[ Monday, December 24, 2007 06:25: Message edited by: Celtic Minstrel ]
Posts: 334 | Registered: Friday, September 14 2007 07:00
Shock Trooper
Member # 10488
Profile #15
(sorry about the triple post)

I think the following chunk of code is somehow to blame for the PC editor currently not working.
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.
Posts: 334 | Registered: Friday, September 14 2007 07:00
Apprentice
Member # 11730
Profile Homepage #16
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:
wineg++ -c -mno-cygwin -I. -o actions.o actions.cpp
global.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 ‘*’ token
graphutl.h:4: error: expected ‘,’ or ‘...’ before ‘*’ token
graphutl.h:6: error: expected ‘,’ or ‘...’ before ‘*’ token
graphutl.h:7: error: expected initializer before ‘*’ token
graphutl.h:10: error: expected ‘,’ or ‘...’ before ‘*’ token
actions.cpp: In function ‘void check_cd_event(HWND__*, UINT, UINT, LONG)’:
actions.cpp:1511: error: ‘MAKEPOINT’ was not declared in this scope
actions.cpp: In function ‘void flash_rect(RECT)’:
actions.cpp:1571: error: ‘SetViewportOrg’ was not declared in this scope
actions.cpp: In function ‘void flash_round_rect(RECT, short int)’:
actions.cpp:1603: error: ‘SetViewportOrg’ was not declared in this scope
actions.cpp: In function ‘Boolean handle_keystroke(UINT, LONG)’:
actions.cpp:1829: error: ‘GFSR_USERRESOURCES’ was not declared in this scope
actions.cpp:1829: error: ‘GetFreeSystemResources’ was not declared in this scope
actions.cpp:1832: error: ‘GFSR_GDIRESOURCES’ was not declared in this scope
winegcc: g++ failed
make: *** [actions.o] Error 2
PC editor:
wineg++ -c -mno-cygwin -I. -o bladpced.o bladpced.cpp
global.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 ‘*’ token
graphutl.h:2: error: expected ‘,’ or ‘...’ before ‘*’ token
graphutl.h:5: error: expected ‘,’ or ‘...’ before ‘*’ token
graphutl.h:6: error: expected ‘,’ or ‘...’ before ‘*’ token
graphutl.h:7: error: expected ‘,’ or ‘...’ before ‘*’ token
graphutl.h:8: error: expected initializer before ‘*’ token
bladpced.cpp:171: error: ‘_export’ does not name a type
bladpced.cpp:174: warning: ‘__stdcall__’ attribute only applies to function types
bladpced.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 scope
bladpced.cpp:174: error: ‘hPrevInstance’ was not declared in this scope
bladpced.cpp:175: error: ‘lpszCmdParam’ was not declared in this scope
bladpced.cpp:175: error: ‘nCmdShow’ was not declared in this scope
bladpced.cpp:180: error: expected unqualified-id before ‘{’ token
winegcc: g++ failed
make: *** [bladpced.o] Error 2
Scenario Editor:
wineg++ -c -mno-cygwin -I. -o blscened.o blscened.cpp
global.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 void
tfileio.h:9: error: ‘Str255’ was not declared in this scope
tfileio.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 expression
tfileio.h:36: error: variable or field ‘flip_rect’ declared void
tfileio.h:36: error: ‘Rect’ was not declared in this scope
tfileio.h:36: error: ‘s’ was not declared in this scope
graphutl.h:3: error: expected ‘,’ or ‘...’ before ‘*’ token
graphutl.h:4: error: expected ‘,’ or ‘...’ before ‘*’ token
graphutl.h:6: error: expected ‘,’ or ‘...’ before ‘*’ token
graphutl.h:7: error: expected initializer before ‘*’ token
graphutl.h:10: error: expected ‘,’ or ‘...’ before ‘*’ token
blscened.cpp:154: error: ‘_export’ does not name a type
blscened.cpp:157: warning: ‘__stdcall__’ attribute only applies to function types
blscened.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 scope
blscened.cpp:157: error: ‘hPrevInstance’ was not declared in this scope
blscened.cpp:158: error: ‘lpszCmdParam’ was not declared in this scope
blscened.cpp:158: error: ‘nCmdShow’ was not declared in this scope
blscened.cpp:163: error: expected unqualified-id before ‘{’ token
winegcc: g++ failed
make: *** [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....

[ Monday, December 24, 2007 17:34: Message edited by: King InuYasha ]
Posts: 29 | Registered: Friday, November 9 2007 08:00
Infiltrator
Member # 5576
Profile Homepage #17
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 .

--------------------
Überraschung des Dosenöffners!
"On guard, you musty sofa!"
Posts: 627 | Registered: Monday, March 7 2005 08:00
Shock Trooper
Member # 10488
Profile #18
Do you mean this?
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.

:/
Posts: 334 | Registered: Friday, September 14 2007 07:00
Infiltrator
Member # 5576
Profile Homepage #19
Hm. Are you getting the picture's rectangle using the function that Jeff suggests in the other thread?

--------------------
Überraschung des Dosenöffners!
"On guard, you musty sofa!"
Posts: 627 | Registered: Monday, March 7 2005 08:00
Shock Trooper
Member # 10488
Profile #20
Hmm. You must mean this:
QDGetPictureBounds( current_pic_handle, &pic_rect);instead of this:
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.
Posts: 334 | Registered: Friday, September 14 2007 07:00
Apprentice
Member # 11730
Profile Homepage #21
Yay! I feel somewhat happy! As simple as it is, it still means I managed to actually port some code!

First rev of wx basics: http://hg.sharesource.org/oboecross32/rev/6860af0cad94
Edit: oops, corrected slight error: http://hg.sharesource.org/oboecross32/rev/a40065e2900c

*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"

[ Thursday, December 27, 2007 15:49: Message edited by: King InuYasha ]

--------------------
Open Blades of Exile Cross 32-bit Project
Know any Win16=>Win32 porting resources? Let me know!
Posts: 29 | Registered: Friday, November 9 2007 08:00