From 4d398d1fa6a124166d70616f28c571363e82331c Mon Sep 17 00:00:00 2001 From: Martin Schaffner Date: Sun, 1 Aug 2004 13:08:34 +0000 Subject: [PATCH] New file for supporting compilation with MPW for carbon (Mac OS 9) --- ChangeLog | 4 + D2X.make | 500 ++++++++++++++++++++++++++++++++++++ arch/carbon/SDL_main.c | 566 +++++++++++++++++++++++++++++++++++++++++ arch/carbon/conf.h | 189 ++++++++++++++ arch/carbon/descent.r | 84 ++++++ arch/carbon/findfile.c | 99 +++++++ arch/carbon/gui.c | 38 +++ arch/include/gui.h | 12 + 8 files changed, 1492 insertions(+) create mode 100644 D2X.make create mode 100644 arch/carbon/SDL_main.c create mode 100755 arch/carbon/conf.h create mode 100755 arch/carbon/descent.r create mode 100644 arch/carbon/findfile.c create mode 100644 arch/carbon/gui.c create mode 100644 arch/include/gui.h diff --git a/ChangeLog b/ChangeLog index 01dfe703..29517efa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,10 @@ main/movie.c, main/newmenu.c, main/playsave.c, main/songs.c, main/state.c, main/text.c: add "#ifdef macintosh" for carbon target. + * D2X.make, arch/include/gui.h, arch/carbon/gui.c, arch/carbon/conf.h, + arch/carbon/findfile.c, arch/carbon/SDL_main.c, arch/carbon/descent.r: + New files for supporting compilation with MPW for carbon (Mac OS 9). + 2004-06-26 Chris Taylor * main/gamemine.c, main/gamemine.h, main/gamesave.c: remove some diff --git a/D2X.make b/D2X.make new file mode 100644 index 00000000..89a2b288 --- /dev/null +++ b/D2X.make @@ -0,0 +1,500 @@ +# File: D2X.make +# Purpose: Compile d2x (descent 2 port to Unix) with MPW for Mac OS 9 +# Target: D2X +# Created: Saturday, June 12, 2004 04:38:06 PM + + +MAKEFILE = D2X.make +¥MondoBuild¥ = #{MAKEFILE} Make blank to avoid rebuilds when makefile is modified + +D2XFolder = 'G3 Hard Disk:Games:D2X (Descent 2) Ä:' +ObjDir = ":obj:" +Includes = ¶ + -i :include: ¶ + -i :arch:include: ¶ + -i "{CIncludes}SDL:" ¶ + -i :arch:carbon: ¶ + -i "{CIncludes}" ¶ + -i :main: + +Sym-PPC = #-sym on + +PPCCOptions = {Includes} -includes unix {Sym-PPC} -d HAVE_CONFIG_H -enum int -d TARGET_API_MAC_CARBON=1 -noMapCR + +### Source Files ### + +SrcFiles = ¶ + :2d:2dsline.c ¶ + :2d:bitblt.c ¶ + :2d:bitmap.c ¶ + :2d:box.c ¶ + :2d:canvas.c ¶ + :2d:circle.c ¶ + :2d:disc.c ¶ + :2d:font.c ¶ + :2d:gpixel.c ¶ + :2d:ibitblt.c ¶ + :2d:line.c ¶ + :2d:palette.c ¶ + :2d:pcx.c ¶ + :2d:pixel.c ¶ + :2d:poly.c ¶ + :2d:rect.c ¶ + :2d:rle.c ¶ + :2d:scalec.c ¶ + :2d:tmerge.c ¶ + :3d:clipper.c ¶ + :3d:draw.c ¶ + :3d:globvars.c ¶ + :3d:instance.c ¶ + :3d:interp.c ¶ + :3d:matrix.c ¶ + :3d:points.c ¶ + :3d:rod.c ¶ + :3d:setup.c ¶ + :arch:carbon:findfile.c ¶ + :arch:carbon:gui.c ¶ + :arch:carbon:SDL_main.c ¶ + :arch:linux:init.c ¶ + :arch:linux:mono.c ¶ + :arch:ogl:gr.c ¶ + :arch:ogl:ogl.c ¶ + :arch:ogl:sdlgl.c ¶ + :arch:sdl:digi.c ¶ + :arch:sdl:event.c ¶ + :arch:sdl:init.c ¶ + :arch:sdl:joy.c ¶ + :arch:sdl:joydefs.c ¶ + :arch:sdl:key.c ¶ + :arch:sdl:mouse.c ¶ + :arch:sdl:rbaudio.c ¶ + :arch:sdl:timer.c ¶ + :cfile:cfile.c ¶ + :iff:iff.c ¶ + :libmve:decoder16.c ¶ + :libmve:decoder8.c ¶ + :libmve:mvelib.c ¶ + :libmve:mveplay.c ¶ + :libmve:mve_audio.c ¶ + :main:ai.c ¶ + :main:ai2.c ¶ + :main:aipath.c ¶ + :main:automap.c ¶ + :main:bm.c ¶ + :main:cmd.c ¶ + :main:cntrlcen.c ¶ + :main:collide.c ¶ + :main:config.c ¶ + :main:console.c ¶ + :main:controls.c ¶ + :main:credits.c ¶ + :main:crypt.c ¶ + :main:effects.c ¶ + :main:endlevel.c ¶ + :main:escort.c ¶ + :main:fireball.c ¶ + :main:fuelcen.c ¶ + :main:fvi.c ¶ + :main:game.c ¶ + :main:gamecntl.c ¶ + :main:gamefont.c ¶ + :main:gamemine.c ¶ + :main:gamepal.c ¶ + :main:gamerend.c ¶ + :main:gamesave.c ¶ + :main:gameseg.c ¶ + :main:gameseq.c ¶ + :main:gauges.c ¶ + :main:hostage.c ¶ + :main:hud.c ¶ + :main:inferno.c ¶ + :main:kconfig.c ¶ + :main:kludge.c ¶ +# :main:kmatrix.c ¶ + :main:laser.c ¶ + :main:lighting.c ¶ + :main:menu.c ¶ + :main:mglobal.c ¶ + :main:mission.c ¶ + :main:morph.c ¶ + :main:movie.c ¶ +# :main:multi.c ¶ +# :main:multibot.c ¶ +# :main:netmisc.c ¶ +# :main:network.c ¶ + :main:newdemo.c ¶ + :main:newmenu.c ¶ + :main:object.c ¶ + :main:paging.c ¶ + :main:physics.c ¶ + :main:piggy.c ¶ + :main:player.c ¶ + :main:playsave.c ¶ + :main:polyobj.c ¶ + :main:powerup.c ¶ + :main:render.c ¶ + :main:robot.c ¶ + :main:scores.c ¶ + :main:segment.c ¶ + :main:slew.c ¶ + :main:songs.c ¶ + :main:state.c ¶ + :main:switch.c ¶ + :main:terrain.c ¶ + :main:texmerge.c ¶ + :main:text.c ¶ + :main:titles.c ¶ + :main:vclip.c ¶ + :main:wall.c ¶ + :main:weapon.c ¶ + :maths:fixc.c ¶ + :maths:rand.c ¶ + :maths:tables.c ¶ + :maths:vecmat.c ¶ + :mem:mem.c ¶ + :misc:args.c ¶ + :misc:d_io.c ¶ + :misc:error.c ¶ + :misc:hash.c ¶ + :misc:strio.c ¶ + :misc:strutil.c ¶ + :texmap:ntmap.c ¶ + :texmap:scanline.c ¶ + :texmap:tmapflat.c + + +### Object Files ### + +ObjFiles-PPC = ¶ + "{ObjDir}2dsline.c.x" ¶ + "{ObjDir}bitblt.c.x" ¶ + "{ObjDir}bitmap.c.x" ¶ + "{ObjDir}box.c.x" ¶ + "{ObjDir}canvas.c.x" ¶ + "{ObjDir}circle.c.x" ¶ + "{ObjDir}disc.c.x" ¶ + "{ObjDir}font.c.x" ¶ + "{ObjDir}gpixel.c.x" ¶ + "{ObjDir}ibitblt.c.x" ¶ + "{ObjDir}line.c.x" ¶ + "{ObjDir}palette.c.x" ¶ + "{ObjDir}pcx.c.x" ¶ + "{ObjDir}pixel.c.x" ¶ + "{ObjDir}poly.c.x" ¶ + "{ObjDir}rect.c.x" ¶ + "{ObjDir}rle.c.x" ¶ + "{ObjDir}scalec.c.x" ¶ + "{ObjDir}tmerge.c.x" ¶ + "{ObjDir}clipper.c.x" ¶ + "{ObjDir}draw.c.x" ¶ + "{ObjDir}globvars.c.x" ¶ + "{ObjDir}instance.c.x" ¶ + "{ObjDir}interp.c.x" ¶ + "{ObjDir}matrix.c.x" ¶ + "{ObjDir}points.c.x" ¶ + "{ObjDir}rod.c.x" ¶ + "{ObjDir}setup.c.x" ¶ + "{ObjDir}findfile.c.x" ¶ + "{ObjDir}gui.c.x" ¶ + "{ObjDir}SDL_main.c.x" ¶ + "{ObjDir}init.c.x" ¶ + "{ObjDir}mono.c.x" ¶ + "{ObjDir}SDL:init.c.x" ¶ + "{ObjDir}gr.c.x" ¶ + "{ObjDir}ogl.c.x" ¶ + "{ObjDir}sdlgl.c.x" ¶ + "{ObjDir}digi.c.x" ¶ + "{ObjDir}event.c.x" ¶ + "{ObjDir}joy.c.x" ¶ + "{ObjDir}joydefs.c.x" ¶ + "{ObjDir}key.c.x" ¶ + "{ObjDir}mouse.c.x" ¶ + "{ObjDir}rbaudio.c.x" ¶ + "{ObjDir}timer.c.x" ¶ + "{ObjDir}cfile.c.x" ¶ + "{ObjDir}iff.c.x" ¶ + "{ObjDir}decoder16.c.x" ¶ + "{ObjDir}decoder8.c.x" ¶ + "{ObjDir}mvelib.c.x" ¶ + "{ObjDir}mveplay.c.x" ¶ + "{ObjDir}mve_audio.c.x" ¶ + "{ObjDir}ai.c.x" ¶ + "{ObjDir}ai2.c.x" ¶ + "{ObjDir}aipath.c.x" ¶ + "{ObjDir}automap.c.x" ¶ + "{ObjDir}bm.c.x" ¶ + "{ObjDir}cmd.c.x" ¶ + "{ObjDir}cntrlcen.c.x" ¶ + "{ObjDir}collide.c.x" ¶ + "{ObjDir}config.c.x" ¶ + "{ObjDir}console.c.x" ¶ + "{ObjDir}controls.c.x" ¶ + "{ObjDir}credits.c.x" ¶ + "{ObjDir}crypt.c.x" ¶ + "{ObjDir}effects.c.x" ¶ + "{ObjDir}endlevel.c.x" ¶ + "{ObjDir}escort.c.x" ¶ + "{ObjDir}fireball.c.x" ¶ + "{ObjDir}fuelcen.c.x" ¶ + "{ObjDir}fvi.c.x" ¶ + "{ObjDir}game.c.x" ¶ + "{ObjDir}gamecntl.c.x" ¶ + "{ObjDir}gamefont.c.x" ¶ + "{ObjDir}gamemine.c.x" ¶ + "{ObjDir}gamepal.c.x" ¶ + "{ObjDir}gamerend.c.x" ¶ + "{ObjDir}gamesave.c.x" ¶ + "{ObjDir}gameseg.c.x" ¶ + "{ObjDir}gameseq.c.x" ¶ + "{ObjDir}gauges.c.x" ¶ + "{ObjDir}hostage.c.x" ¶ + "{ObjDir}hud.c.x" ¶ + "{ObjDir}inferno.c.x" ¶ + "{ObjDir}kconfig.c.x" ¶ + "{ObjDir}kludge.c.x" ¶ +# "{ObjDir}kmatrix.c.x" ¶ + "{ObjDir}laser.c.x" ¶ + "{ObjDir}lighting.c.x" ¶ + "{ObjDir}menu.c.x" ¶ + "{ObjDir}mglobal.c.x" ¶ + "{ObjDir}mission.c.x" ¶ + "{ObjDir}morph.c.x" ¶ + "{ObjDir}movie.c.x" ¶ +# "{ObjDir}multi.c.x" ¶ +# "{ObjDir}multibot.c.x" ¶ +# "{ObjDir}netmisc.c.x" ¶ +# "{ObjDir}network.c.x" ¶ + "{ObjDir}newdemo.c.x" ¶ + "{ObjDir}newmenu.c.x" ¶ + "{ObjDir}object.c.x" ¶ + "{ObjDir}paging.c.x" ¶ + "{ObjDir}physics.c.x" ¶ + "{ObjDir}piggy.c.x" ¶ + "{ObjDir}player.c.x" ¶ + "{ObjDir}playsave.c.x" ¶ + "{ObjDir}polyobj.c.x" ¶ + "{ObjDir}powerup.c.x" ¶ + "{ObjDir}render.c.x" ¶ + "{ObjDir}robot.c.x" ¶ + "{ObjDir}scores.c.x" ¶ + "{ObjDir}segment.c.x" ¶ + "{ObjDir}slew.c.x" ¶ + "{ObjDir}songs.c.x" ¶ + "{ObjDir}state.c.x" ¶ + "{ObjDir}switch.c.x" ¶ + "{ObjDir}terrain.c.x" ¶ + "{ObjDir}texmerge.c.x" ¶ + "{ObjDir}text.c.x" ¶ + "{ObjDir}titles.c.x" ¶ + "{ObjDir}vclip.c.x" ¶ + "{ObjDir}wall.c.x" ¶ + "{ObjDir}weapon.c.x" ¶ + "{ObjDir}fixc.c.x" ¶ + "{ObjDir}rand.c.x" ¶ + "{ObjDir}tables.c.x" ¶ + "{ObjDir}vecmat.c.x" ¶ + "{ObjDir}mem.c.x" ¶ + "{ObjDir}args.c.x" ¶ + "{ObjDir}d_io.c.x" ¶ + "{ObjDir}error.c.x" ¶ + "{ObjDir}hash.c.x" ¶ + "{ObjDir}strio.c.x" ¶ + "{ObjDir}strutil.c.x" ¶ + "{ObjDir}ntmap.c.x" ¶ + "{ObjDir}scanline.c.x" ¶ + "{ObjDir}tmapflat.c.x" + + +### Libraries ### + +LibFiles-PPC = ¶ + "{SharedLibraries}SDL" ¶ + "{SharedLibraries}CarbonLib" ¶ + "{SharedLibraries}StdCLib" ¶ + "{SharedLibraries}OpenGLLibraryStub" ¶ + "{SharedLibraries}OpenGLUtilityStub" ¶ + "{PPCLibraries}StdCRuntime.o" ¶ + "{PPCLibraries}PPCCRuntime.o" ¶ + "{PPCLibraries}PPCToolLibs.o" + + +### Default Rules ### + +.c.x Ä .c {¥MondoBuild¥} + {PPCC} {depDir}{default}.c -o {targDir}{default}.c.x {PPCCOptions} + + +### Build Rules ### + +D2X ÄÄ directories {ObjFiles-PPC} {LibFiles-PPC} {¥MondoBuild¥} + PPCLink ¶ + -o {D2XFolder}{Targ} ¶ + {ObjFiles-PPC} ¶ + {LibFiles-PPC} ¶ + {Sym-PPC} ¶ + -mf -d ¶ + -m __appstart ¶ + -t 'APPL' ¶ + -c 'DCT2' + Rez -a -o {D2XFolder}{Targ} ":arch:carbon:descent.r" + + +# This is used to create the directories needed for build +directories Ä + if !`Exists obj` ; NewFolder obj ; end + if !`Exists :obj:SDL` ; NewFolder :obj:SDL ; end + + +### Required Dependencies ### + +"{ObjDir}2dsline.c.x" Ä :2d:2dsline.c +"{ObjDir}bitblt.c.x" Ä :2d:bitblt.c +"{ObjDir}bitmap.c.x" Ä :2d:bitmap.c +"{ObjDir}box.c.x" Ä :2d:box.c +"{ObjDir}canvas.c.x" Ä :2d:canvas.c +"{ObjDir}circle.c.x" Ä :2d:circle.c +"{ObjDir}disc.c.x" Ä :2d:disc.c +"{ObjDir}font.c.x" Ä :2d:font.c +"{ObjDir}gpixel.c.x" Ä :2d:gpixel.c +"{ObjDir}ibitblt.c.x" Ä :2d:ibitblt.c +"{ObjDir}line.c.x" Ä :2d:line.c +"{ObjDir}palette.c.x" Ä :2d:palette.c +"{ObjDir}pcx.c.x" Ä :2d:pcx.c +"{ObjDir}pixel.c.x" Ä :2d:pixel.c +"{ObjDir}poly.c.x" Ä :2d:poly.c +"{ObjDir}rect.c.x" Ä :2d:rect.c +"{ObjDir}rle.c.x" Ä :2d:rle.c +"{ObjDir}scalec.c.x" Ä :2d:scalec.c +"{ObjDir}tmerge.c.x" Ä :2d:tmerge.c +"{ObjDir}clipper.c.x" Ä :3d:clipper.c +"{ObjDir}draw.c.x" Ä :3d:draw.c +"{ObjDir}globvars.c.x" Ä :3d:globvars.c +"{ObjDir}instance.c.x" Ä :3d:instance.c +"{ObjDir}interp.c.x" Ä :3d:interp.c +"{ObjDir}matrix.c.x" Ä :3d:matrix.c +"{ObjDir}points.c.x" Ä :3d:points.c +"{ObjDir}rod.c.x" Ä :3d:rod.c +"{ObjDir}setup.c.x" Ä :3d:setup.c +"{ObjDir}findfile.c.x" Ä :arch:carbon:findfile.c +"{ObjDir}gui.c.x" Ä :arch:carbon:gui.c +"{ObjDir}SDL_main.c.x" Ä :arch:carbon:SDL_main.c +"{ObjDir}init.c.x" Ä :arch:linux:init.c +"{ObjDir}mono.c.x" Ä :arch:linux:mono.c +"{ObjDir}gr.c.x" Ä :arch:ogl:gr.c +"{ObjDir}ogl.c.x" Ä :arch:ogl:ogl.c +"{ObjDir}sdlgl.c.x" Ä :arch:ogl:sdlgl.c +"{ObjDir}digi.c.x" Ä :arch:sdl:digi.c +"{ObjDir}event.c.x" Ä :arch:sdl:event.c +"{ObjDir}SDL:init.c.x" Ä :arch:sdl:init.c +"{ObjDir}joy.c.x" Ä :arch:sdl:joy.c +"{ObjDir}joydefs.c.x" Ä :arch:sdl:joydefs.c +"{ObjDir}key.c.x" Ä :arch:sdl:key.c +"{ObjDir}mouse.c.x" Ä :arch:sdl:mouse.c +"{ObjDir}rbaudio.c.x" Ä :arch:sdl:rbaudio.c +"{ObjDir}timer.c.x" Ä :arch:sdl:timer.c +"{ObjDir}cfile.c.x" Ä :cfile:cfile.c +"{ObjDir}iff.c.x" Ä :iff:iff.c +"{ObjDir}decoder16.c.x" Ä :libmve:decoder16.c +"{ObjDir}decoder8.c.x" Ä :libmve:decoder8.c +"{ObjDir}mvelib.c.x" Ä :libmve:mvelib.c +"{ObjDir}mveplay.c.x" Ä :libmve:mveplay.c +"{ObjDir}mve_audio.c.x" Ä :libmve:mve_audio.c +"{ObjDir}ai.c.x" Ä :main:ai.c +"{ObjDir}ai2.c.x" Ä :main:ai2.c +"{ObjDir}aipath.c.x" Ä :main:aipath.c +"{ObjDir}automap.c.x" Ä :main:automap.c +"{ObjDir}bm.c.x" Ä :main:bm.c +"{ObjDir}cmd.c.x" Ä :main:cmd.c +"{ObjDir}cntrlcen.c.x" Ä :main:cntrlcen.c +"{ObjDir}collide.c.x" Ä :main:collide.c +"{ObjDir}config.c.x" Ä :main:config.c +"{ObjDir}console.c.x" Ä :main:console.c +"{ObjDir}controls.c.x" Ä :main:controls.c +"{ObjDir}credits.c.x" Ä :main:credits.c +"{ObjDir}crypt.c.x" Ä :main:crypt.c +"{ObjDir}effects.c.x" Ä :main:effects.c +"{ObjDir}endlevel.c.x" Ä :main:endlevel.c +"{ObjDir}escort.c.x" Ä :main:escort.c +"{ObjDir}fireball.c.x" Ä :main:fireball.c +"{ObjDir}fuelcen.c.x" Ä :main:fuelcen.c +"{ObjDir}fvi.c.x" Ä :main:fvi.c +"{ObjDir}game.c.x" Ä :main:game.c +"{ObjDir}gamecntl.c.x" Ä :main:gamecntl.c +"{ObjDir}gamefont.c.x" Ä :main:gamefont.c +"{ObjDir}gamemine.c.x" Ä :main:gamemine.c +"{ObjDir}gamepal.c.x" Ä :main:gamepal.c +"{ObjDir}gamerend.c.x" Ä :main:gamerend.c +"{ObjDir}gamesave.c.x" Ä :main:gamesave.c +"{ObjDir}gameseg.c.x" Ä :main:gameseg.c +"{ObjDir}gameseq.c.x" Ä :main:gameseq.c +"{ObjDir}gauges.c.x" Ä :main:gauges.c +"{ObjDir}hostage.c.x" Ä :main:hostage.c +"{ObjDir}hud.c.x" Ä :main:hud.c +"{ObjDir}inferno.c.x" Ä :main:inferno.c +"{ObjDir}kconfig.c.x" Ä :main:kconfig.c +"{ObjDir}kludge.c.x" Ä :main:kludge.c +#"{ObjDir}kmatrix.c.x" Ä :main:kmatrix.c +"{ObjDir}laser.c.x" Ä :main:laser.c +"{ObjDir}lighting.c.x" Ä :main:lighting.c +"{ObjDir}menu.c.x" Ä :main:menu.c +"{ObjDir}mglobal.c.x" Ä :main:mglobal.c +"{ObjDir}mission.c.x" Ä :main:mission.c +"{ObjDir}morph.c.x" Ä :main:morph.c +"{ObjDir}movie.c.x" Ä :main:movie.c +#"{ObjDir}multi.c.x" Ä :main:multi.c +#"{ObjDir}multibot.c.x" Ä :main:multibot.c +#"{ObjDir}netmisc.c.x" Ä :main:netmisc.c +#"{ObjDir}network.c.x" Ä :main:network.c +"{ObjDir}newdemo.c.x" Ä :main:newdemo.c +"{ObjDir}newmenu.c.x" Ä :main:newmenu.c +"{ObjDir}object.c.x" Ä :main:object.c +"{ObjDir}paging.c.x" Ä :main:paging.c +"{ObjDir}physics.c.x" Ä :main:physics.c +"{ObjDir}piggy.c.x" Ä :main:piggy.c +"{ObjDir}player.c.x" Ä :main:player.c +"{ObjDir}playsave.c.x" Ä :main:playsave.c +"{ObjDir}polyobj.c.x" Ä :main:polyobj.c +"{ObjDir}powerup.c.x" Ä :main:powerup.c +"{ObjDir}render.c.x" Ä :main:render.c +"{ObjDir}robot.c.x" Ä :main:robot.c +"{ObjDir}scores.c.x" Ä :main:scores.c +"{ObjDir}segment.c.x" Ä :main:segment.c +"{ObjDir}slew.c.x" Ä :main:slew.c +"{ObjDir}songs.c.x" Ä :main:songs.c +"{ObjDir}state.c.x" Ä :main:state.c +"{ObjDir}switch.c.x" Ä :main:switch.c +"{ObjDir}terrain.c.x" Ä :main:terrain.c +"{ObjDir}texmerge.c.x" Ä :main:texmerge.c +"{ObjDir}text.c.x" Ä :main:text.c +"{ObjDir}titles.c.x" Ä :main:titles.c +"{ObjDir}vclip.c.x" Ä :main:vclip.c +"{ObjDir}wall.c.x" Ä :main:wall.c +"{ObjDir}weapon.c.x" Ä :main:weapon.c +"{ObjDir}fixc.c.x" Ä :maths:fixc.c +"{ObjDir}rand.c.x" Ä :maths:rand.c +"{ObjDir}tables.c.x" Ä :maths:tables.c +"{ObjDir}vecmat.c.x" Ä :maths:vecmat.c +"{ObjDir}mem.c.x" Ä :mem:mem.c +"{ObjDir}args.c.x" Ä :misc:args.c +"{ObjDir}d_io.c.x" Ä :misc:d_io.c +"{ObjDir}error.c.x" Ä :misc:error.c +"{ObjDir}hash.c.x" Ä :misc:hash.c +"{ObjDir}strio.c.x" Ä :misc:strio.c +"{ObjDir}strutil.c.x" Ä :misc:strutil.c +"{ObjDir}ntmap.c.x" Ä :texmap:ntmap.c +"{ObjDir}scanline.c.x" Ä :texmap:scanline.c +"{ObjDir}tmapflat.c.x" Ä :texmap:tmapflat.c + + +### Optional Dependencies ### +### Build this target to generate "include file" dependencies. ### + +Dependencies Ä $OutOfDate + MakeDepend ¶ + -append {MAKEFILE} ¶ + -ignore "{CIncludes}" ¶ + -objdir "{ObjDir}" ¶ + -objext .x ¶ + {Includes} ¶ + {SrcFiles} + diff --git a/arch/carbon/SDL_main.c b/arch/carbon/SDL_main.c new file mode 100644 index 00000000..5be1ccd0 --- /dev/null +++ b/arch/carbon/SDL_main.c @@ -0,0 +1,566 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2004 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id: SDL_main.c,v 1.1 2004-08-01 13:08:34 schaffner Exp $"; +#endif + +/* This file takes care of command line argument parsing, and stdio redirection + in the MacOS environment. + */ + +#ifdef HAVE_CONFIG_H +#include "conf.h" +#endif + +#include +#include +#include +#include +#if defined(__APPLE__) && defined(__MACH__) +#include +#elif TARGET_API_MAC_CARBON +#include +#else +#include +#include +#include +#include +#include +#endif + +/* Include the SDL main definition header */ +#include "SDL.h" +#include "SDL_main.h" +#ifdef main +#undef main +#endif + +/* The standard output files */ +#define STDOUT_FILE "stdout.txt" +#define STDERR_FILE "stderr.txt" + +#if !defined(__MWERKS__) && !TARGET_API_MAC_CARBON + /* In MPW, the qd global has been removed from the libraries */ + QDGlobals qd; +#endif + +/* Structure for keeping prefs in 1 variable */ +typedef struct { + Str255 command_line; + Str255 video_driver_name; + Boolean output_to_file; +} PrefsRecord; + +/* See if the command key is held down at startup */ +static Boolean CommandKeyIsDown(void) +{ + KeyMap theKeyMap; + + GetKeys(theKeyMap); + + if (((unsigned char *) theKeyMap)[6] & 0x80) { + return(true); + } + return(false); +} + +/* Parse a command line buffer into arguments */ +static int ParseCommandLine(char *cmdline, char **argv) +{ + char *bufp; + int argc; + + argc = 0; + for ( bufp = cmdline; *bufp; ) { + /* Skip leading whitespace */ + while ( isspace(*bufp) ) { + ++bufp; + } + /* Skip over argument */ + if ( *bufp == '"' ) { + ++bufp; + if ( *bufp ) { + if ( argv ) { + argv[argc] = bufp; + } + ++argc; + } + /* Skip over word */ + while ( *bufp && (*bufp != '"') ) { + ++bufp; + } + } else { + if ( *bufp ) { + if ( argv ) { + argv[argc] = bufp; + } + ++argc; + } + /* Skip over word */ + while ( *bufp && ! isspace(*bufp) ) { + ++bufp; + } + } + if ( *bufp ) { + if ( argv ) { + *bufp = '\0'; + } + ++bufp; + } + } + if ( argv ) { + argv[argc] = NULL; + } + return(argc); +} + +/* Remove the output files if there was no output written */ +static void cleanup_output(void) +{ + FILE *file; + int empty; + + /* Flush the output in case anything is queued */ + fclose(stdout); + fclose(stderr); + + /* See if the files have any output in them */ + file = fopen(STDOUT_FILE, "rb"); + if ( file ) { + empty = (fgetc(file) == EOF) ? 1 : 0; + fclose(file); + if ( empty ) { + remove(STDOUT_FILE); + } + } + file = fopen(STDERR_FILE, "rb"); + if ( file ) { + empty = (fgetc(file) == EOF) ? 1 : 0; + fclose(file); + if ( empty ) { + remove(STDERR_FILE); + } + } +} + +static int getCurrentAppName (StrFileName name) { + + ProcessSerialNumber process; + ProcessInfoRec process_info; + FSSpec process_fsp; + + process.highLongOfPSN = 0; + process.lowLongOfPSN = kCurrentProcess; + process_info.processInfoLength = sizeof (process_info); + process_info.processName = NULL; + process_info.processAppSpec = &process_fsp; + + if ( noErr != GetProcessInformation (&process, &process_info) ) + return 0; + + memcpy (name, process_fsp.name, process_fsp.name[0] + 1); + return 1; +} + +static int getPrefsFile (FSSpec *prefs_fsp, int create) { + + /* The prefs file name is the application name, possibly truncated, */ + /* plus " Preferences */ + + #define SUFFIX " Preferences" + #define MAX_NAME 19 /* 31 - strlen (SUFFIX) */ + + short volume_ref_number; + long directory_id; + StrFileName prefs_name; + StrFileName app_name; + + /* Get Preferences folder - works with Multiple Users */ + if ( noErr != FindFolder ( kOnSystemDisk, kPreferencesFolderType, kDontCreateFolder, + &volume_ref_number, &directory_id) ) + exit (-1); + + if ( ! getCurrentAppName (app_name) ) + exit (-1); + + /* Truncate if name is too long */ + if (app_name[0] > MAX_NAME ) + app_name[0] = MAX_NAME; + + memcpy (prefs_name + 1, app_name + 1, app_name[0]); + memcpy (prefs_name + app_name[0] + 1, SUFFIX, strlen (SUFFIX)); + prefs_name[0] = app_name[0] + strlen (SUFFIX); + + /* Make the file spec for prefs file */ + if ( noErr != FSMakeFSSpec (volume_ref_number, directory_id, prefs_name, prefs_fsp) ) + if ( !create ) + return 0; + else { + /* Create the prefs file */ + memcpy (prefs_fsp->name, prefs_name, prefs_name[0] + 1); + prefs_fsp->parID = directory_id; + prefs_fsp->vRefNum = volume_ref_number; + + FSpCreateResFile (prefs_fsp, '????', 'pref', 0); + + if ( noErr != ResError () ) + return 0; + } + + return 1; +} + +static int readPrefsResource (PrefsRecord *prefs) { + + Handle prefs_handle; + + prefs_handle = Get1Resource( 'CLne', 128 ); + + if (prefs_handle != NULL) { + int offset = 0; + + HLock(prefs_handle); + + /* Get command line string */ + memcpy (prefs->command_line, *prefs_handle, (*prefs_handle)[0]+1); + + /* Get video driver name */ + offset += (*prefs_handle)[0] + 1; + memcpy (prefs->video_driver_name, *prefs_handle + offset, (*prefs_handle)[offset] + 1); + + /* Get save-to-file option (1 or 0) */ + offset += (*prefs_handle)[offset] + 1; + prefs->output_to_file = (*prefs_handle)[offset]; + + ReleaseResource( prefs_handle ); + + return ResError() == noErr; + } + + return 0; +} + +static int writePrefsResource (PrefsRecord *prefs, short resource_file) { + + Handle prefs_handle; + + UseResFile (resource_file); + + prefs_handle = Get1Resource ( 'CLne', 128 ); + if (prefs_handle != NULL) + RemoveResource (prefs_handle); + + prefs_handle = NewHandle ( prefs->command_line[0] + prefs->video_driver_name[0] + 4 ); + if (prefs_handle != NULL) { + + int offset; + + HLock (prefs_handle); + + /* Command line text */ + offset = 0; + memcpy (*prefs_handle, prefs->command_line, prefs->command_line[0] + 1); + + /* Video driver name */ + offset += prefs->command_line[0] + 1; + memcpy (*prefs_handle + offset, prefs->video_driver_name, prefs->video_driver_name[0] + 1); + + /* Output-to-file option */ + offset += prefs->video_driver_name[0] + 1; + *( *((char**)prefs_handle) + offset) = (char)prefs->output_to_file; + *( *((char**)prefs_handle) + offset + 1) = 0; + + AddResource (prefs_handle, 'CLne', 128, "\pCommand Line"); + WriteResource (prefs_handle); + UpdateResFile (resource_file); + DisposeHandle (prefs_handle); + + return ResError() == noErr; + } + + return 0; +} + +static int readPreferences (PrefsRecord *prefs) { + + int no_error = 1; + FSSpec prefs_fsp; + + /* Check for prefs file first */ + if ( getPrefsFile (&prefs_fsp, 0) ) { + + short prefs_resource; + + prefs_resource = FSpOpenResFile (&prefs_fsp, fsRdPerm); + if ( prefs_resource == -1 ) /* this shouldn't happen, but... */ + return 0; + + UseResFile (prefs_resource); + no_error = readPrefsResource (prefs); + CloseResFile (prefs_resource); + } + + /* Fall back to application's resource fork (reading only, so this is safe) */ + else { + + no_error = readPrefsResource (prefs); + } + + return no_error; +} + +static int writePreferences (PrefsRecord *prefs) { + + int no_error = 1; + FSSpec prefs_fsp; + + /* Get prefs file, create if it doesn't exist */ + if ( getPrefsFile (&prefs_fsp, 1) ) { + + short prefs_resource; + + prefs_resource = FSpOpenResFile (&prefs_fsp, fsRdWrPerm); + if (prefs_resource == -1) + return 0; + no_error = writePrefsResource (prefs, prefs_resource); + CloseResFile (prefs_resource); + } + + return no_error; +} + +/* This is where execution begins */ +int main(int argc, char *argv[]) +{ + +#pragma unused(argc, argv) + +#define DEFAULT_ARGS "\p" /* pascal string for default args */ +#define DEFAULT_VIDEO_DRIVER "\ptoolbox" /* pascal string for default video driver name */ +#define DEFAULT_OUTPUT_TO_FILE 1 /* 1 == output to file, 0 == no output */ + +#define VIDEO_ID_DRAWSPROCKET 1 /* these correspond to popup menu choices */ +#define VIDEO_ID_TOOLBOX 2 + + PrefsRecord prefs = { DEFAULT_ARGS, DEFAULT_VIDEO_DRIVER, DEFAULT_OUTPUT_TO_FILE }; + + int nargs; + char **args; + char *commandLine; + + StrFileName appNameText; + int videodriver = VIDEO_ID_TOOLBOX; + int settingsChanged = 0; + + long i; + + /* Kyle's SDL command-line dialog code ... */ +#if !TARGET_API_MAC_CARBON + InitGraf (&qd.thePort); + InitFonts (); + InitWindows (); + InitMenus (); + InitDialogs (nil); +#endif + InitCursor (); + FlushEvents(everyEvent,0); +#if !TARGET_API_MAC_CARBON + MaxApplZone (); +#endif + MoreMasters (); + MoreMasters (); +#if 0 + /* Intialize SDL, and put up a dialog if we fail */ + if ( SDL_Init (0) < 0 ) { + +#define kErr_OK 1 +#define kErr_Text 2 + + DialogPtr errorDialog; + short dummyType; + Rect dummyRect; + Handle dummyHandle; + short itemHit; + + errorDialog = GetNewDialog (1001, nil, (WindowPtr)-1); + DrawDialog (errorDialog); + + GetDialogItem (errorDialog, kErr_Text, &dummyType, &dummyHandle, &dummyRect); + SetDialogItemText (dummyHandle, "\pError Initializing SDL"); + + SetPort (errorDialog); + do { + ModalDialog (nil, &itemHit); + } while (itemHit != kErr_OK); + + DisposeDialog (errorDialog); + exit (-1); + } + atexit(cleanup_output); + atexit(SDL_Quit); +#endif + +/* Set up SDL's QuickDraw environment */ +#if !TARGET_API_MAC_CARBON + SDL_InitQuickDraw(&qd); +#endif + + if ( readPreferences (&prefs) ) { + + if (memcmp (prefs.video_driver_name+1, "DSp", 3) == 0) + videodriver = 1; + else if (memcmp (prefs.video_driver_name+1, "toolbox", 7) == 0) + videodriver = 2; + } + + if ( CommandKeyIsDown() ) { + +#define kCL_OK 1 +#define kCL_Cancel 2 +#define kCL_Text 3 +#define kCL_File 4 +#define kCL_Video 6 + + DialogPtr commandDialog; + short dummyType; + Rect dummyRect; + Handle dummyHandle; + short itemHit; + + /* Assume that they will change settings, rather than do exhaustive check */ + settingsChanged = 1; + + /* Create dialog and display it */ + commandDialog = GetNewDialog (1000, nil, (WindowPtr)-1); + SetPortDialogPort (commandDialog); + + /* Setup controls */ + GetDialogItem (commandDialog, kCL_File, &dummyType, &dummyHandle, &dummyRect); /* MJS */ + SetControlValue ((ControlHandle)dummyHandle, prefs.output_to_file ); + + GetDialogItem (commandDialog, kCL_Text, &dummyType, &dummyHandle, &dummyRect); + SetDialogItemText (dummyHandle, prefs.command_line); + + GetDialogItem (commandDialog, kCL_Video, &dummyType, &dummyHandle, &dummyRect); + SetControlValue ((ControlRef)dummyHandle, videodriver); + + SetDialogDefaultItem (commandDialog, kCL_OK); + SetDialogCancelItem (commandDialog, kCL_Cancel); + + do { + + ModalDialog(nil, &itemHit); /* wait for user response */ + + /* Toggle command-line output checkbox */ + if ( itemHit == kCL_File ) { + GetDialogItem(commandDialog, kCL_File, &dummyType, &dummyHandle, &dummyRect); /* MJS */ + SetControlValue((ControlHandle)dummyHandle, !GetControlValue((ControlHandle)dummyHandle) ); + } + + } while (itemHit != kCL_OK && itemHit != kCL_Cancel); + + /* Get control values, even if they did not change */ + GetDialogItem (commandDialog, kCL_Text, &dummyType, &dummyHandle, &dummyRect); /* MJS */ + GetDialogItemText (dummyHandle, prefs.command_line); + + GetDialogItem (commandDialog, kCL_File, &dummyType, &dummyHandle, &dummyRect); /* MJS */ + prefs.output_to_file = GetControlValue ((ControlHandle)dummyHandle); + + GetDialogItem (commandDialog, kCL_Video, &dummyType, &dummyHandle, &dummyRect); + videodriver = GetControlValue ((ControlRef)dummyHandle); + + DisposeDialog (commandDialog); + + if (itemHit == kCL_Cancel ) { + exit (0); + } + } + + /* Set pseudo-environment variables for video driver, update prefs */ + switch ( videodriver ) { + case VIDEO_ID_DRAWSPROCKET: + putenv ("SDL_VIDEODRIVER=DSp"); + memcpy (prefs.video_driver_name, "\pDSp", 4); + break; + case VIDEO_ID_TOOLBOX: + putenv ("SDL_VIDEODRIVER=toolbox"); + memcpy (prefs.video_driver_name, "\ptoolbox", 8); + break; + } + /* Redirect standard I/O to files */ + if ( prefs.output_to_file ) { + freopen (STDOUT_FILE, "w", stdout); + freopen (STDERR_FILE, "w", stderr); + } else { + fclose (stdout); + fclose (stderr); + } + + if (settingsChanged) { + /* Save the prefs, even if they might not have changed (but probably did) */ + if ( ! writePreferences (&prefs) ) + fprintf (stderr, "WARNING: Could not save preferences!\n"); + } + + getCurrentAppName (appNameText); /* check for error here ? */ + + commandLine = (char*) malloc (appNameText[0] + prefs.command_line[0] + 2); + if ( commandLine == NULL ) { + exit(-1); + } + + /* Rather than rewrite ParseCommandLine method, let's replace */ + /* any spaces in application name with underscores, */ + /* so that the app name is only 1 argument */ + for (i = 1; i < 1+appNameText[0]; i++) + if ( appNameText[i] == ' ' ) appNameText[i] = '_'; + + /* Copy app name & full command text to command-line C-string */ + memcpy (commandLine, appNameText + 1, appNameText[0]); + commandLine[appNameText[0]] = ' '; + memcpy (commandLine + appNameText[0] + 1, prefs.command_line + 1, prefs.command_line[0]); + commandLine[ appNameText[0] + 1 + prefs.command_line[0] ] = '\0'; + + /* Parse C-string into argv and argc */ + nargs = ParseCommandLine (commandLine, NULL); + args = (char **)malloc((nargs+1)*(sizeof *args)); + if ( args == NULL ) { + exit(-1); + } + ParseCommandLine (commandLine, args); + + /* Run the main application code */ + SDL_main(nargs, args); + free (args); + free (commandLine); + + /* Remove useless stdout.txt and stderr.txt */ + cleanup_output (); + + /* Exit cleanly, calling atexit() functions */ + exit (0); + + /* Never reached, but keeps the compiler quiet */ + return (0); +} diff --git a/arch/carbon/conf.h b/arch/carbon/conf.h new file mode 100755 index 00000000..aa6196a8 --- /dev/null +++ b/arch/carbon/conf.h @@ -0,0 +1,189 @@ +/* conf.h. Generated by configure. */ +/* conf.h.in. Generated from configure.ac by autoheader. */ +// Modified by Chris to work for an Apple computer with OS 9 or above + +/* Define to enable console */ +/* #undef CONSOLE */ + +/* d2x major version */ +#define D2XMAJOR 0 + +/* d2x micro version */ +#define D2XMICRO 5 + +/* d2x minor version */ +#define D2XMINOR 2 + +/* Define if you want to build the editor */ +/* #undef EDITOR */ + +/* Define for faster i/o on little-endian cpus */ +/* #undef FAST_FILE_IO */ + +/* Define if you want a GGI build */ +/* #undef GGI */ + +/* Define to 1 if you have the declaration of `nanosleep', and to 0 if you + don't. */ +#define HAVE_DECL_NANOSLEEP 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_NETIPX_IPX_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define if you want to build for mac datafiles */ +//#define MACDATA + +/* Define to disable asserts, int3, etc. */ +/* #undef NDEBUG */ + +/* Define if you want an assembler free build */ +#define NO_ASM + +/* Define if you want an OpenGL build */ +#define OGL + +/* Name of package */ +#define PACKAGE "d2x" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "descent-source@warpcore.org" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "d2x" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "d2x 0.2.6" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "d2x" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "0.2.6" + +/* Define for a "release" build */ +/* #undef RELEASE */ + +/* Define if you have the SDL_image library */ +/* #undef SDL_IMAGE */ + +/* Define this to be the shared game directory root */ +#define SHAREPATH "/Users/christaylor/share/games/d2x" + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define if you want an SVGALib build */ +/* #undef SVGA */ + +/* define to not use the SDL_Joystick routines. */ +/* #undef USE_LINUX_JOY */ + +/* Version number of package */ +#define VERSION "0.2.6" + +/* Define to 1 if your processor stores words with the most significant byte + first (like Motorola and SPARC, unlike Intel and VAX). */ +#define WORDS_BIGENDIAN 1 + +/* Define if your processor needs data to be word-aligned */ +/* #undef WORDS_NEED_ALIGNMENT */ + + + /* General defines */ +#ifndef PACKAGE_STRING +#define PACKAGE_STRING "d2x 0.2.6" +#endif +#define VERSION_NAME PACKAGE_STRING +#define NMONO 1 +#define PIGGY_USE_PAGING 1 +#define NEWDEMO 1 + +#if defined(__APPLE__) && defined(__MACH__) +#define __unix__ +/* Define if you want a network build */ +#define NETWORK + +/* Define to 1 if the system has the type `struct timespec'. */ +#define HAVE_STRUCT_TIMESPEC 1 + +/* Define to 1 if the system has the type `struct timeval'. */ +#define HAVE_STRUCT_TIMEVAL 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +#else // Mac OS 9 +# ifndef __MWERKS__ +# define inline +# endif + +#define TARGET_API_MAC_CARBON 1 +/* Define to 1 if the system has the type `struct timespec'. */ +#define HAVE_STRUCT_TIMESPEC 0 + +/* Define to 1 if the system has the type `struct timeval'. */ +#define HAVE_STRUCT_TIMEVAL 0 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 0 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 0 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 0 + +#endif // OS 9/X + +#ifdef __unix__ +# ifdef GGI +# define GII_INPUT 1 +# define GGI_VIDEO 1 +# else +# ifdef SVGA +# define SVGALIB_INPUT 1 +# define SVGALIB_VIDEO 1 +# else +# define SDL_INPUT 1 +# ifdef OGL +# define SDL_GL_VIDEO 1 +# else +# define SDL_VIDEO 1 +# endif +# endif +# endif +#endif + +#ifdef macintosh +# define SDL_INPUT 1 +# ifdef OGL +# define SDL_GL_VIDEO 1 +# else +# define SDL_VIDEO 1 +# endif +#endif + diff --git a/arch/carbon/descent.r b/arch/carbon/descent.r new file mode 100755 index 00000000..8268eb10 --- /dev/null +++ b/arch/carbon/descent.r @@ -0,0 +1,84 @@ + +#include "Processes.r" + +resource 'SIZE' (-1) { + reserved, + acceptSuspendResumeEvents, + reserved, + canBackground, + doesActivateOnFGSwitch, + backgroundAndForeground, + getFrontClicks, + ignoreAppDiedEvents, + is32BitCompatible, + isHighLevelEventAware, + onlyLocalHLEvents, + notStationeryAware, + useTextEditServices, + reserved, + reserved, + reserved, + 30000*1024, // 30 megs minimum + 50000*1024 // 50 megs maximum +}; + +data 'carb' (0) {}; + +data 'DLOG' (1000) { + $"0072 0040 00EA 01B3 0001 0100 0000 0000 0000 03E8 0C43 6F6D 6D61 6E64 204C 696E" /* .r.@.ê.³...........è.Command Lin */ + $"6500 280A" /* e.( */ +}; + +data 'DLOG' (1001) { + $"0072 0040 00DB 01AC 0001 0100 0000 0000 0000 03E9 0C45 7272 6F72 2057 696E 646F" /* .r.@.Û.¬...........é.Error Windo */ + $"7700 280A" /* w.( */ +}; + +data 'DLOG' (1002) { + $"00B8 00BE 0147 01D8 0005 0100 0000 0000 0000 03EA 1643 6F6E 6669 726D 2044 6973" /* .¸.¾.G.Ø...........ê.Confirm Dis */ + $"706C 6179 2043 6861 6E67 6510 280A" /* play Change.( */ +}; + +data 'DITL' (1000) { + $"0005 0000 0000 0052 0113 0066 0158 0402 4F4B 0000 0000 0052 00C2 0066 0107 0406" /* .......R...f.X..OK.....R.Â.f.... */ + $"4361 6E63 656C 0000 0000 000F 0084 001F 0155 1000 0000 0000 0054 0019 0066 007D" /* Cancel.......„...U.......T...f.} */ + $"050E 4F75 7470 7574 2074 6F20 6669 6C65 0000 0000 000F 0018 001F 007F 080D 436F" /* ..Output to file..............Co */ + $"6D6D 616E 6420 4C69 6E65 3A00 0000 0000 0030 0018 0040 0158 0702 0080" /* mmand Line:......0...@.X...€ */ +}; + +data 'DITL' (1001) { + $"0001 0000 0000 0046 0120 005A 015A 0402 4F4B 0000 0000 0010 000A 0038 0160 0800" /* .......F. .Z.Z..OK.......Â.8.`.. */ +}; + +data 'DITL' (1002) { + $"0002 0000 0000 006F 001E 0083 0058 0406 4361 6E63 656C 0000 0000 006E 00C0 0082" /* .......o...ƒ.X..Cancel.....n.À.‚ */ + $"00FA 0402 4F4B 0000 0000 000E 000F 005F 010C 88B3 5468 6520 7365 7474 696E 6720" /* .ú..OK........._..ˆ³The setting */ + $"666F 7220 796F 7572 206D 6F6E 6974 6F72 2068 6173 2062 6565 6E20 6368 616E 6765" /* for your monitor has been change */ + $"642C 2061 6E64 2069 7420 6D61 7920 6E6F 7420 6265 2064 6973 706C 6179 6564 2063" /* d, and it may not be displayed c */ + $"6F72 7265 6374 6C79 2E20 546F 2063 6F6E 6669 726D 2074 6865 2064 6973 706C 6179" /* orrectly. To confirm the display */ + $"2069 7320 636F 7272 6563 742C 2063 6C69 636B 204F 4B2E 2054 6F20 7265 7475 726E" /* is correct, click OK. To return */ + $"2074 6F20 7468 6520 6F72 6967 696E 616C 2073 6574 7469 6E67 2C20 636C 6963 6B20" /* to the original setting, click */ + $"4361 6E63 656C 2E00" /* Cancel.. */ +}; + +data 'MENU' (128, preload) { + $"0080 0000 0000 0000 0000 FFFF FFFB 0114 0C41 626F 7574 2053 444C 2E2E 2E00 0000" /* .€........ÿÿÿû...About SDL...... */ + $"0001 2D00 0000 0000" /* ..-..... */ +}; + +data 'MENU' (129) { + $"0081 0000 0000 0000 0000 FFFF FFFF 0C56 6964 656F 2044 7269 7665 7219 4472 6177" /* .........ÿÿÿÿ.Video Driver.Draw */ + $"5370 726F 636B 6574 2028 4675 6C6C 7363 7265 656E 2900 0000 001E 546F 6F6C 426F" /* Sprocket (Fullscreen).....ToolBo */ + $"7820 2028 4675 6C6C 7363 7265 656E 2F57 696E 646F 7765 6429 0000 0000 00" /* x (Fullscreen/Windowed)..... */ +}; + +data 'CNTL' (128) { + $"0000 0000 0010 0140 0000 0100 0064 0081 03F0 0000 0000 0D56 6964 656F 2044 7269" /* .......@.....d..ð.....Video Dri */ + $"7665 723A" /* ver: */ +}; + +data 'TMPL' (128, "CLne") { + $"0C43 6F6D 6D61 6E64 204C 696E 6550 5354 520C 5669 6465 6F20 4472 6976 6572 5053" /* .Command LinePSTR.Video DriverPS */ + $"5452 0C53 6176 6520 546F 2046 696C 6542 4F4F 4C" /* TR.Save To FileBOOL */ +}; + diff --git a/arch/carbon/findfile.c b/arch/carbon/findfile.c new file mode 100644 index 00000000..1596a733 --- /dev/null +++ b/arch/carbon/findfile.c @@ -0,0 +1,99 @@ +/* + * findfile.c + * D2X (Descent2) + * + * Created by Chris Taylor on Tue Jun 22 2004. + * + */ + +#ifdef HAVE_CONFIG_H +#include "conf.h" +#endif + +#include "pstypes.h" +#include "findfile.h" +#include "u_mem.h" +#include "strutil.h" + +#ifdef macintosh +#include +extern void macify_posix_path(char *posix_path, char *mac_path); +#else +#include +#endif + +// Gets the names of matching files and the number of matching files. +int FindFiles(char *search_str, int max_matches, char **names) +{ + FSRef parent; + char path[_MAX_PATH]; + int path_len; + FSRef *refs; + ItemCount num_found = 0; + FSIterator iterator; + int i; + OSStatus myErr; + + for (path_len = 0; *search_str && *search_str != '*'; path_len ++) + path[path_len] = *search_str++; + path[path_len] = 0; + if (*search_str == '*') + search_str++; + +#ifdef macintosh + // Convert the search directory to an FSRef in a way that OS 9 can handle + { + FSSpec parentSpec; + Str255 pascalPath; + + macify_posix_path(path, path); + CopyCStringToPascal(path, pascalPath); + if (FSMakeFSSpec(0, 0, pascalPath, &parentSpec) != noErr) + return 0; + if (FSpMakeFSRef(&parentSpec, &parent) != noErr) + return 0; + } +#else +// "This function, though available through Carbon on Mac OS 8 and 9, is only implemented on Mac OS X." + if ((myErr = FSPathMakeRef((unsigned char const *) (path_len? path : "."), &parent, NULL)) != noErr) + return 0; +#endif + if (FSRefMakePath(&parent, (unsigned char *) path, _MAX_PATH) != noErr) // Get the full path, to get the length + return 0; + path_len = strlen(path) +#ifndef macintosh + + 1 // For the '/' +#endif + ; + + if (FSOpenIterator(&parent, kFSIterateFlat, &iterator) != noErr) + return 0; + + MALLOC(refs, FSRef, max_matches); + + do { + ItemCount num_new_files; + + myErr = FSGetCatalogInfoBulk(iterator, max_matches, &num_new_files, NULL, kFSCatInfoNone, NULL, refs, NULL, NULL); + + for (i = 0; i < num_new_files; i++) { + char *p = path + path_len; + char *filename; + + FSRefMakePath (refs + i, (unsigned char *) path, 255); + for (filename = p; *filename && strnicmp(filename, search_str, strlen(search_str)); filename++) {} + + if (*filename) { + strncpy(*names, p, 12); + num_found++; + names++; + } + } + } while (myErr == noErr && num_found < max_matches); + + d_free(refs); + if (FSCloseIterator(iterator) != noErr) + return 0; + + return num_found; +} diff --git a/arch/carbon/gui.c b/arch/carbon/gui.c new file mode 100644 index 00000000..790f926c --- /dev/null +++ b/arch/carbon/gui.c @@ -0,0 +1,38 @@ +/* + * gui.c + * D2X (Descent2) + * + * Created by Chris Taylor on Sat Jul 03 2004. + * + */ + +#ifdef HAVE_CONFIG_H +#include "conf.h" +#endif + +#ifdef __APPLE__ +#include +#else +#include +#endif + +void ErrorDialog(char *message) +{ + Str255 pascal_message; + short itemHit; // Insists on returning this + + CopyCStringToPascal(message, pascal_message); + ShowCursor(); + StandardAlert(kAlertStopAlert, pascal_message, NULL, 0, &itemHit); +} + +void WarningDialog(char *s) +{ + Str255 pascal_message; + short itemHit; // Insists on returning this + + CopyCStringToPascal(s, pascal_message); + ShowCursor(); + StandardAlert(kAlertCautionAlert, pascal_message, NULL, 0, &itemHit); + HideCursor(); +} diff --git a/arch/include/gui.h b/arch/include/gui.h new file mode 100644 index 00000000..2595165e --- /dev/null +++ b/arch/include/gui.h @@ -0,0 +1,12 @@ +/* + * gui.h + * D2X (Descent2) + * + * Created by Chris Taylor on Sat Jul 03 2004. + * + * Functions that use an OS's graphical interface directly + */ + +extern void ErrorDialog(char *message); + +extern void WarningDialog(char *s); -- 2.39.2