Previous 15994 Revisions Next

r7086 Wednesday 20th January, 2010 at 19:57:22 UTC by Miodrag Milanović
-Make all compile in one EXE file in windows build, no more DLL's
- WINUI temporary disabled
- Fixed building 64bit code, but it breaks on driver start
[src/mess/osd/windows]climain.c menu.c mess.rc messlib.c opcntrl.c windows.mak

src/mess/osd/windows/messlib.c
r7085r7086
1//============================================================
2//
3//  messlib.c - Entry points for messlib.dll
4//
5//============================================================
6
7// We want to use the main() in src/windows/main.c, but we have
8// to export the entry point with dllexport.  So we'll do a trick
9// to wrap it
10#define MESSLIB
11#undef main
12#undef wmain
13#define main mame_main
14#define wmain mame_main
15#include "windows/main.c"
16#undef main
17
18//============================================================
19//  mess_cli_main - main entry proc for CLI MESS
20//============================================================
21
22int __declspec(dllexport) mess_cli_main(int argc, TCHAR **argv)
23{
24   return mame_main(argc, argv);
25}
26
27
28
29//============================================================
30//  mess_gui_main - main entry proc for GUI MESS
31//============================================================
32
33int __declspec(dllexport) mess_gui_main(
34   HINSTANCE    hInstance,
35   HINSTANCE    hPrevInstance,
36   LPTSTR       lpCmdLine,
37   int          nCmdShow)
38{
39
40   extern int MameUIMain(HINSTANCE,LPTSTR,int);
41   return MameUIMain(hInstance, lpCmdLine, nCmdShow);
42}
src/mess/osd/windows/climain.c
r7085r7086
1#include <windows.h>
2#include <tchar.h>
3
4#ifdef main
5#undef main
6#endif
7
8#ifdef wmain
9#undef wmain
10#endif
11
12int __declspec(dllimport) mess_cli_main(int argc, TCHAR **argv);
13
14extern "C" int _tmain(int argc, TCHAR*argv[])
15{
16   return mess_cli_main(argc, argv);
17}
src/mess/osd/windows/menu.c
r7085r7086
21482148   }
21492149   return 0;
21502150}
2151
2152void win_mess_dummy()
2153{
2154   char mess_directory[1024];
2155   
2156    /* first set up the working directory to be the MESS directory */
2157    osd_get_emulator_directory(mess_directory, ARRAY_LENGTH(mess_directory));
2158}
src/mess/osd/windows/windows.mak
r7085r7086
88
99
1010# build the executable names
11FULLGUINAME = $(PREFIX)$(NAME)ui$(SUFFIX)$(DEBUGSUFFIX)
12EMULATORCLI = $(FULLNAME)$(EXE)
13EMULATORGUI = $(FULLGUINAME)$(EXE)
14EMULATORDLL = $(FULLNAME)lib.dll
15EMULATOR += $(EMULATORDLL) $(EMULATORGUI)
16
17CFLAGS += -DWINUI -DEMULATORDLL=\"$(EMULATORDLL)\"
1811RCFLAGS += -DMESS
1912
2013LIBS += -lcomdlg32
r7085r7086
2619MESS_WINSRC = src/mess/osd/windows
2720MESS_WINOBJ = $(OBJ)/mess/osd/windows
2821
22RESFILE = $(MESS_WINOBJ)/mess.res
23
2924OSDOBJS += \
3025   $(MESS_WINOBJ)/configms.o   \
3126   $(MESS_WINOBJ)/dialog.o   \
3227   $(MESS_WINOBJ)/menu.o      \
3328   $(MESS_WINOBJ)/mess.res   \
34   $(MESS_WINOBJ)/messlib.o   \
3529   $(MESS_WINOBJ)/opcntrl.o
3630
3731$(LIBOSD): $(OSDOBJS)
r7085r7086
4539
4640$(LIBOCORE_NOMAIN): $(OSDCOREOBJS:$(WINOBJ)/main.o=)
4741
48
49ifdef MSVC_BUILD
50DLLLINK = lib
51else
52DLLLINK = dll
53endif
54
55
56
5742#-------------------------------------------------
58# if building with a UI, include the ui.mak
59#-------------------------------------------------
60
61include $(SRC)/mess/osd/winui/winui.mak
62
63
64
65#-------------------------------------------------
6643# generic rules for the resource compiler
6744#-------------------------------------------------
6845
r7085r7086
7047   @echo Compiling resources $<...
7148   $(RC) $(RCDEFS) $(RCFLAGS) --include-dir mess/$(OSD) -o $@ -i $<
7249
73
74
75#-------------------------------------------------
76# executable targets
77#-------------------------------------------------
78
79EXECUTABLE_DEFINED = 1
80
81$(EMULATORDLL): $(VERSIONOBJ) $(OBJ)/mess/osd/windows/messlib.o $(DRVLIBS) $(LIBOSD) $(LIBEMU) $(LIBCPU) $(LIBDASM) $(LIBSOUND) $(LIBUTIL) $(EXPAT) $(ZLIB) $(LIBOCORE) $(MESS_WINOBJ)/mess.res
82# always recompile the version string
83   $(CC) $(CDEFS) $(CFLAGS) -c $(SRC)/version.c -o $(VERSIONOBJ)
84   @echo Linking $@...
85   $(LD) -shared $(LDFLAGS) $(LDFLAGSEMULATOR) $^ $(LIBS) -o $@
86
87# gui target
88$(EMULATORGUI):   $(EMULATORDLL) $(OBJ)/mess/osd/winui/guimain.o $(GUIRESFILE)
89   @echo Linking $@...
90   $(LD) $(LDFLAGS) $(LDFLAGSEMULATOR) -mwindows $(FULLNAME)lib.$(DLLLINK) $(OBJ)/mess/osd/winui/guimain.o $(GUIRESFILE) $(LIBS) -o $@
91
92# cli target
93$(EMULATORCLI):   $(EMULATORDLL) $(OBJ)/mess/osd/windows/climain.o
94   @echo Linking $@...
95   $(LD) $(LDFLAGS) $(LDFLAGSEMULATOR) -mconsole $(FULLNAME)lib.$(DLLLINK) $(OBJ)/mess/osd/windows/climain.o $(LIBS) -o $@
src/mess/osd/windows/opcntrl.c
r7085r7086
190190   optreserr_t err;
191191   HANDLE h;
192192   void *val;
193   int i_val;
194   
193195
194196   guide = (const option_guide *) GetProp(control, guide_prop);
195197   optspec = (const char *) GetProp(control, spec_prop);
r7085r7086
199201   switch(guide->option_type)
200202   {
201203      case OPTIONTYPE_INT:
202         val = (void*)atoi(buf);
203         err = option_resolution_isvalidvalue(optspec, guide->parameter, (int)val);
204         i_val = atoi(buf);
205         err = option_resolution_isvalidvalue(optspec, guide->parameter, i_val);
204206         if (err)
205207         {
206208            h = GetProp(control, value_prop);
r7085r7086
210212         }
211213         else
212214         {
213            SetProp(control, value_prop, (HANDLE) val);
215            SetProp(control, value_prop, (HANDLE) i_val);
214216         }
215217         break;
216218
src/mess/osd/windows/mess.rc
r7085r7086
154154// Icon
155155//
156156
157IDI_ICON_MESS           ICON    DISCARDABLE     "../../osd/winui/res/mess.ico"
157158IDI_ICON_CART           ICON    DISCARDABLE     "../../osd/winui/res/cpu.ico"
158159IDI_ICON_HARD           ICON    DISCARDABLE     "../../osd/winui/res/harddisk.ico"
159160IDI_ICON_CASS           ICON    DISCARDABLE     "../../mess/osd/winui/res/win_cass.ico"

Previous 15994 Revisions Next


© 1998-2018 The MESS Team