[Scummvm-cvs-logs] CVS: simon Makefile,NONE,1.1 simon.cpp,1.1.1.1,1.2 simon.dsp,1.1.1.1,1.2 simon.h,1.1.1.1,1.2 stdafx.h,1.1.1.1,1.2 sys.cpp,1.1.1.1,1.2 video.cpp,1.1.1.1,1.2

Ludvig Strigeus strigeus at users.sourceforge.net
Sun Apr 7 09:00:14 CEST 2002


Update of /cvsroot/scummvm/simon
In directory usw-pr-cvs1:/tmp/cvs-serv5329

Modified Files:
	simon.cpp simon.dsp simon.h stdafx.h sys.cpp video.cpp 
Added Files:
	Makefile 
Log Message:
changed to compile on FreeBSD

--- NEW FILE: Makefile ---
# $Header: /cvsroot/scummvm/simon/Makefile,v 1.1 2002/04/07 15:43:38 strigeus Exp $

CC      = gcc
CFLAGS  = -g -O -Wstrict-prototypes -Wno-long-long -Wno-multichar 
DEFINES = -DUNIX
LDFLAGS :=
INCLUDES:= `sdl-config --cflags` -I./
CPPFLAGS= $(DEFINES) $(INCLUDES)

# Add -lmad for -DCOMPRESSED_SOUND_FILE
LIBS	= `sdl-config --libs` -lncurses -lm

INCS	= simon.h stdafx.h

OBJS	= simon.o 2xsai.o sys.o video.o

.cpp.o:
	$(CC) $(CFLAGS) $(CPPFLAGS) -c $(<) -o $*.o

all: simon

simon: $(OBJS)
	$(CC) $(LDFLAGS) -o $(@) $(OBJS) $(LIBS)

$(OBJS): Makefile

clean:
	rm -f $(OBJS) simon

check:
$(OBJS): $(INCS)

Index: simon.cpp
===================================================================
RCS file: /cvsroot/scummvm/simon/simon.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** simon.cpp	6 Apr 2002 09:58:55 -0000	1.1.1.1
--- simon.cpp	7 Apr 2002 15:43:38 -0000	1.2
***************
*** 5,9 ****
--- 5,11 ----
  
  #include <time.h>
+ #ifdef WIN32
  #include <malloc.h>
+ #endif
  
  SimonState simon;
***************
*** 435,439 ****
  
  SubroutineLine *SimonState::createSubroutineLine(Subroutine *sub, int where) {
! 	SubroutineLine *sl, *cur_sl, *last_sl = NULL;
  
  	if (sub->id == 0)
--- 437,441 ----
  
  SubroutineLine *SimonState::createSubroutineLine(Subroutine *sub, int where) {
! 	SubroutineLine *sl, *cur_sl = NULL, *last_sl = NULL;
  
  	if (sub->id == 0)
***************
*** 5971,5977 ****
  		_timer_5 --;
  	} else {
! 		start = timeGetTime();
  		timer_proc1();
! 		end = timeGetTime();
  
  //		if (start + 45 < end) {
--- 5973,5979 ----
  		_timer_5 --;
  	} else {
! //		start = timeGetTime();
  		timer_proc1();
! //		end = timeGetTime();
  
  //		if (start + 45 < end) {
***************
*** 5981,6000 ****
  }
  
- void _stdcall SimonState::timer_callback_win(uint id, uint msg, uint32 dwuser, uint32 dw1, uint32 dw2 ) {
- 	SimonState *s = (SimonState*)dwuser;
- 	uint last;
- 	static uint prev_time = 0;
- 
- 	last = timeGetTime();
- 
- 	if (last/50 > prev_time/50) {
- 		prev_time = last;
- 		
- 		s->_invoke_timer_callback++;
- 	} else {
- 		prev_time = prev_time;
- 	}
- }
- 
  void SimonState::checkTimerCallback() {
  	if (_invoke_timer_callback && !_in_callback) {
--- 5983,5986 ----
***************
*** 7485,7489 ****
  
  
! int _cdecl SimonState::game_thread_proc(void *param) {
  	SimonState *s = (SimonState*)param;
  	while(1) {
--- 7471,7475 ----
  
  
! int CDECL SimonState::game_thread_proc(void *param) {
  	SimonState *s = (SimonState*)param;
  	while(1) {
***************
*** 7515,7519 ****
  	openGameFile();
  
! 	_last_music_played = -1;
  	_vga_base_delay = 1;
  #ifdef SIMON2
--- 7501,7505 ----
  	openGameFile();
  
! 	_last_music_played = (uint)-1;
  	_vga_base_delay = 1;
  #ifdef SIMON2

Index: simon.dsp
===================================================================
RCS file: /cvsroot/scummvm/simon/simon.dsp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** simon.dsp	6 Apr 2002 09:58:55 -0000	1.1.1.1
--- simon.dsp	7 Apr 2002 15:43:39 -0000	1.2
***************
*** 20,24 ****
  !MESSAGE "simon - Win32 Release" (based on "Win32 (x86) Console Application")
  !MESSAGE "simon - Win32 Debug" (based on "Win32 (x86) Console Application")
- !MESSAGE "simon - Win32 ReleaseDebug" (based on "Win32 (x86) Console Application")
  !MESSAGE 
  
--- 20,23 ----
***************
*** 78,106 ****
  # ADD LINK32 kernel32.lib user32.lib gdi32.lib sdl.lib winmm.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
  
- !ELSEIF  "$(CFG)" == "simon - Win32 ReleaseDebug"
- 
- # PROP BASE Use_MFC 0
- # PROP BASE Use_Debug_Libraries 0
- # PROP BASE Output_Dir "simon___Win32_ReleaseDebug"
- # PROP BASE Intermediate_Dir "simon___Win32_ReleaseDebug"
- # PROP BASE Ignore_Export_Lib 0
- # PROP BASE Target_Dir ""
- # PROP Use_MFC 0
- # PROP Use_Debug_Libraries 0
- # PROP Output_Dir "ReleaseDebug"
- # PROP Intermediate_Dir "ReleaseDebug"
- # PROP Ignore_Export_Lib 0
- # PROP Target_Dir ""
- # ADD BASE CPP /nologo /MD /W3 /Oa /Ow /Og /Oi /Os /Oy /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FAcs /YX /FD /c
- # ADD CPP /nologo /MTd /W3 /Zi /O2 /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
- # ADD BASE RSC /l 0x41d /d "NDEBUG"
- # ADD RSC /l 0x41d /d "NDEBUG"
- BSC32=bscmake.exe
- # ADD BASE BSC32 /nologo
- # ADD BSC32 /nologo
- LINK32=link.exe
- # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib sdl.lib winmm.lib /nologo /subsystem:console /machine:I386
- # ADD LINK32 kernel32.lib user32.lib gdi32.lib sdl.lib winmm.lib /nologo /subsystem:console /map /debug /machine:I386
- 
  !ENDIF 
  
--- 77,80 ----
***************
*** 109,113 ****
  # Name "simon - Win32 Release"
  # Name "simon - Win32 Debug"
- # Name "simon - Win32 ReleaseDebug"
  # Begin Group "Source Files"
  
--- 83,86 ----

Index: simon.h
===================================================================
RCS file: /cvsroot/scummvm/simon/simon.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** simon.h	6 Apr 2002 09:58:54 -0000	1.1.1.1
--- simon.h	7 Apr 2002 15:43:39 -0000	1.2
***************
*** 60,66 ****
  #define ARRAYSIZE(x) (sizeof(x)/sizeof(x[0]))
  #define CHECK_BOUNDS(x,y) assert((uint)(x)<ARRAYSIZE(y))
- #define CHECK_HEAP() assert(_heapchk() == _HEAPOK)
  
  #pragma warning (disable: 4200)
  
  struct Child {
--- 60,68 ----
  #define ARRAYSIZE(x) (sizeof(x)/sizeof(x[0]))
  #define CHECK_BOUNDS(x,y) assert((uint)(x)<ARRAYSIZE(y))
  
+ #ifdef WIN32
+ /* don't complain about zero sized arrays */
  #pragma warning (disable: 4200)
+ #endif
  
  struct Child {
***************
*** 231,234 ****
--- 233,258 ----
  };
  
+ /* dummy typedefs to make it compile in *nix */
+ #ifdef UNIX
+ typedef void* HMIDISTRM;
+ typedef void* HMIDIOUT;
+ typedef uint32 UINT;
+ typedef void* MIDIHDR;
+ typedef uint32 MMRESULT;
+ #define CALLBACK
+ typedef uint32 DWORD;
+ 
+ enum {
+ 	VK_F5 = 1,
+ 	VK_LBUTTON = 2,
+ 	VK_SHIFT = 3,
+ 
+ };
+ 
+ int GetAsyncKeyState(int key);
+ 
+ #endif
+ 
+ 
  class MidiPlayer {
  public:
***************
*** 266,269 ****
--- 290,294 ----
  
  	struct NoteRec {
+ #ifdef WIN32
  		uint32 delay;
  		union {
***************
*** 277,280 ****
--- 302,306 ----
  		uint cmd_length;
  		byte *sysex_data;
+ #endif
  	};
  
***************
*** 930,937 ****
  	void openGameFile();
  
! 	static int _cdecl game_thread_proc(void *param);
  
  	void timer_callback();
- 	static void _stdcall timer_callback_win(uint id, uint msg, uint32 dwuser, uint32 dw1, uint32 dw2 );
  	void timer_proc1();
  
--- 956,962 ----
  	void openGameFile();
  
! 	static int CDECL game_thread_proc(void *param);
  
  	void timer_callback();
  	void timer_proc1();
  
***************
*** 995,1000 ****
  
  	
! void _declspec(noreturn) _cdecl error(const char *errmsg, ...);
! void _cdecl warning(const char *errmsg, ...);
  
  uint16 swap16(uint16 a);
--- 1020,1025 ----
  
  	
! void NORETURN CDECL error(const char *errmsg, ...);
! void CDECL warning(const char *errmsg, ...);
  
  uint16 swap16(uint16 a);

Index: stdafx.h
===================================================================
RCS file: /cvsroot/scummvm/simon/stdafx.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** stdafx.h	6 Apr 2002 09:58:54 -0000	1.1.1.1
--- stdafx.h	7 Apr 2002 15:43:39 -0000	1.2
***************
*** 1,2 ****
--- 1,3 ----
+ #ifdef WIN32
  #pragma once
  
***************
*** 12,15 ****
--- 13,25 ----
  #include <mmsystem.h>
  
+ #ifdef CDECL
+ #undef CDECL
+ #endif
+ 
+ #define CDECL _cdecl
+ #define NORETURN _declspec(noreturn)
+ 
+ #define CHECK_HEAP() assert(_heapchk() == _HEAPOK)
+ 
  typedef unsigned char byte;
  typedef unsigned char uint8;
***************
*** 20,24 ****
--- 30,56 ----
  typedef signed short int16;
  typedef signed long int32;
+ #endif
  
+ #ifdef UNIX
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+ #include <assert.h>
+ #include <SDL.h>
+ #include <SDL_thread.h>
+ #include <stdarg.h>
+ #include <errno.h>
  
+ #define CDECL
+ #define NORETURN
+ #define CHECK_HEAP()
  
+ typedef unsigned char byte;
+ typedef unsigned char uint8;
+ typedef unsigned short uint16;
+ typedef unsigned long uint32;
+ typedef unsigned int uint;
+ typedef signed char int8;
+ typedef signed short int16;
+ typedef signed long int32;
+ #endif

Index: sys.cpp
===================================================================
RCS file: /cvsroot/scummvm/simon/sys.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** sys.cpp	6 Apr 2002 09:58:55 -0000	1.1.1.1
--- sys.cpp	7 Apr 2002 15:43:39 -0000	1.2
***************
*** 5,9 ****
--- 5,12 ----
  
  #include <stdarg.h>
+ 
+ #ifdef WIN32
  #include <conio.h>
+ #endif
  
  uint16 swap16(uint16 a) {
***************
*** 59,63 ****
  
  
! void _declspec(noreturn) _cdecl error(const char *s, ...) {
  	char buf[1024];
  	va_list va;
--- 62,66 ----
  
  
! void NORETURN CDECL error(const char *s, ...) {
  	char buf[1024];
  	va_list va;
***************
*** 66,76 ****
  	vsprintf(buf, s, va);
  	va_end(va);
  	fprintf(stderr, "Error: %s!\nPress a key to quit.\n", buf);
  	_getch();
  	exit(1);
  
  }
  
! void _cdecl warning(const char *s, ...) {
  	char buf[1024];
  	va_list va;
--- 69,83 ----
  	vsprintf(buf, s, va);
  	va_end(va);
+ #ifdef WIN32
  	fprintf(stderr, "Error: %s!\nPress a key to quit.\n", buf);
  	_getch();
+ #else
+ 	fprintf(stderr, "Error: %s!\n", buf);
+ #endif
  	exit(1);
  
  }
  
! void CDECL warning(const char *s, ...) {
  	char buf[1024];
  	va_list va;
***************
*** 81,82 ****
--- 88,106 ----
  	fprintf(stdout, "Warning: %s!\n", buf);
  }
+ 
+ 
+ /* Dummy midiplayer for unix */
+ #ifdef UNIX
+ void MidiPlayer::shutdown() {}
+ void MidiPlayer::read_all_songs(FILE *in) {}
+ void MidiPlayer::initialize() {}
+ void MidiPlayer::play() {}
+ 
+ 
+ /* GetAsyncKeyState for unix */
+ int GetAsyncKeyState(int key) {
+ 	return 0;
+ }
+ 
+ 
+ #endif
\ No newline at end of file

Index: video.cpp
===================================================================
RCS file: /cvsroot/scummvm/simon/video.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** video.cpp	6 Apr 2002 09:58:55 -0000	1.1.1.1
--- video.cpp	7 Apr 2002 15:43:39 -0000	1.2
***************
*** 213,217 ****
  #endif /* USE_2xSAI */
  
! void _cdecl atexit_proc();
  
  void fill_sound(void *userdata, Uint8 *stream, int len);
--- 213,217 ----
  #endif /* USE_2xSAI */
  
! void CDECL atexit_proc();
  
  void fill_sound(void *userdata, Uint8 *stream, int len);





More information about the Scummvm-git-logs mailing list