mirror of
https://github.com/InvisibleUp/uvmac.git
synced 2025-01-17 20:30:48 +00:00
Fix build support for Linux w/ X11 and ALSA
This commit is contained in:
parent
b6fd8fd511
commit
68e9856b49
22
Makefile
22
Makefile
@ -1,17 +1,13 @@
|
|||||||
# Makefile
|
# Makefile
|
||||||
# Currently only builds Mac Plus emulator for Windows x64
|
# Currently only builds Mac Plus emulator for Windows x64
|
||||||
|
|
||||||
mk_COptionsCommon = -Wall -Wmissing-prototypes -Wno-uninitialized -Wundef -Wstrict-prototypes -Icfg/ -Isrc/
|
CC := gcc
|
||||||
mk_COptionsOSGLU = $(mk_COptionsCommon) -O2
|
CCFLAGS := -O2 -Wall -Wmissing-prototypes -Wno-uninitialized -Wundef -Wstrict-prototypes -Icfg/ -Isrc/
|
||||||
mk_COptions = $(mk_COptionsCommon) -O2
|
|
||||||
|
|
||||||
.PHONY: build clean
|
.PHONY: linux windows clean
|
||||||
|
|
||||||
build : minivmac.exe
|
SrcFiles := \
|
||||||
|
|
||||||
SrcFiles = \
|
|
||||||
src/PROGMAIN.c \
|
src/PROGMAIN.c \
|
||||||
src/UI/WIN32/OSGLUWIN.c \
|
|
||||||
src/GLOBGLUE.c \
|
src/GLOBGLUE.c \
|
||||||
src/HW/M68K/M68KITAB.c \
|
src/HW/M68K/M68KITAB.c \
|
||||||
src/HW/M68K/MINEM68K.c \
|
src/HW/M68K/MINEM68K.c \
|
||||||
@ -28,11 +24,15 @@ SrcFiles = \
|
|||||||
src/HW/SOUND/SNDEMDEV.c \
|
src/HW/SOUND/SNDEMDEV.c \
|
||||||
src/UTIL/DATE2SEC.c \
|
src/UTIL/DATE2SEC.c \
|
||||||
|
|
||||||
minivmac.exe :
|
windows :
|
||||||
mkdir -p "bld/"
|
mkdir -p "bld/"
|
||||||
windres -i "src/UI/WIN32/main.rc" --input-format=rc -o "bld/main.res" -O coff --include-dir "src/"
|
windres -i "src/UI/WIN32/main.rc" --input-format=rc -o "bld/main.res" -O coff --include-dir "src/"
|
||||||
gcc -o "minivmac.exe" $(SrcFiles) "bld/main.res" $(mk_COptions) \
|
$(CC) -o "minivmac.exe" $(SrcFiles) "src/UI/WIN32/OSGLUWIN.c" \
|
||||||
-mwindows -lwinmm -lole32 -luuid
|
"bld/main.res" $(CCFLAGS) -mwindows -lwinmm -lole32 -luuid
|
||||||
|
|
||||||
|
linux :
|
||||||
|
mkdir -p "bld/"
|
||||||
|
$(CC) -o "minivmac.exe" $(SrcFiles) "src/UI/UNIX/OSGLUXWN.c" $(CCFLAGS) -lX11 -ldl
|
||||||
|
|
||||||
clean :
|
clean :
|
||||||
rm -r "bld/"
|
rm -r "bld/"
|
||||||
|
@ -20,6 +20,9 @@
|
|||||||
ALSA sound support by Stephan Kochen.
|
ALSA sound support by Stephan Kochen.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
#include <dlfcn.h>
|
||||||
|
|
||||||
#ifndef RaspbianWorkAround
|
#ifndef RaspbianWorkAround
|
||||||
#define RaspbianWorkAround 0
|
#define RaspbianWorkAround 0
|
||||||
#endif
|
#endif
|
||||||
|
@ -35,12 +35,25 @@
|
|||||||
looking at included examples, one by Paul Sheer.
|
looking at included examples, one by Paul Sheer.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <time.h>
|
||||||
|
#include <X11/Xlib.h>
|
||||||
|
#include <X11/Xutil.h>
|
||||||
|
#include <X11/Xresource.h>
|
||||||
|
#include <X11/Xatom.h>
|
||||||
|
#include <X11/keysym.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
|
||||||
|
#include "CNFGGLOB.h"
|
||||||
#include "CNFGRAPI.h"
|
#include "CNFGRAPI.h"
|
||||||
#include "SYSDEPNS.h"
|
#include "SYSDEPNS.h"
|
||||||
#include "UTIL/ENDIANAC.h"
|
#include "UTIL/ENDIANAC.h"
|
||||||
|
|
||||||
#include "UI/MYOSGLUE.h"
|
#include "UI/MYOSGLUE.h"
|
||||||
|
|
||||||
#include "STRCONST.h"
|
#include "STRCONST.h"
|
||||||
|
|
||||||
/* --- some simple utilities --- */
|
/* --- some simple utilities --- */
|
||||||
@ -60,7 +73,7 @@ GLOBALOSGLUPROC MoveBytes(anyp srcPtr, anyp destPtr, int32_t byteCount)
|
|||||||
LOCALVAR char *d_arg = NULL;
|
LOCALVAR char *d_arg = NULL;
|
||||||
LOCALVAR char *n_arg = NULL;
|
LOCALVAR char *n_arg = NULL;
|
||||||
|
|
||||||
#if CanGetAppPath
|
#ifdef CanGetAppPath
|
||||||
LOCALVAR char *app_parent = NULL;
|
LOCALVAR char *app_parent = NULL;
|
||||||
LOCALVAR char *app_name = NULL;
|
LOCALVAR char *app_name = NULL;
|
||||||
#endif
|
#endif
|
||||||
@ -94,7 +107,7 @@ LOCALFUNC tMacErr ChildPath(char *x, char *y, char **r)
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if UseActvFile || IncludeSonyNew
|
#if IncludeSonyNew
|
||||||
LOCALFUNC tMacErr FindOrMakeChild(char *x, char *y, char **r)
|
LOCALFUNC tMacErr FindOrMakeChild(char *x, char *y, char **r)
|
||||||
{
|
{
|
||||||
tMacErr err;
|
tMacErr err;
|
||||||
@ -309,9 +322,7 @@ LOCALFUNC bool NetSupportedContains(Atom x)
|
|||||||
#define WantColorTransValid 1
|
#define WantColorTransValid 1
|
||||||
|
|
||||||
#include "UI/COMOSGLU.h"
|
#include "UI/COMOSGLU.h"
|
||||||
|
#include "UTIL/PBUFSTDC.h"
|
||||||
#include "UTILS/PBUFSTDC.h"
|
|
||||||
|
|
||||||
#include "UI/CONTROLM.h"
|
#include "UI/CONTROLM.h"
|
||||||
|
|
||||||
/* --- text translation --- */
|
/* --- text translation --- */
|
||||||
@ -779,7 +790,7 @@ LOCALFUNC bool Sony_Insert1a(char *drivepath, bool silentfail)
|
|||||||
LOCALFUNC bool Sony_Insert2(char *s)
|
LOCALFUNC bool Sony_Insert2(char *s)
|
||||||
{
|
{
|
||||||
char *d =
|
char *d =
|
||||||
#if CanGetAppPath
|
#ifdef CanGetAppPath
|
||||||
(NULL == d_arg) ? app_parent :
|
(NULL == d_arg) ? app_parent :
|
||||||
#endif
|
#endif
|
||||||
d_arg;
|
d_arg;
|
||||||
@ -875,7 +886,7 @@ LOCALPROC MakeNewDisk0(uint32_t L, char *drivepath)
|
|||||||
LOCALPROC MakeNewDisk(uint32_t L, char *drivename)
|
LOCALPROC MakeNewDisk(uint32_t L, char *drivename)
|
||||||
{
|
{
|
||||||
char *d =
|
char *d =
|
||||||
#if CanGetAppPath
|
#ifdef CanGetAppPath
|
||||||
(NULL == d_arg) ? app_parent :
|
(NULL == d_arg) ? app_parent :
|
||||||
#endif
|
#endif
|
||||||
d_arg;
|
d_arg;
|
||||||
@ -979,12 +990,12 @@ LOCALFUNC tMacErr LoadMacRomFromHome(void)
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if CanGetAppPath
|
#ifdef CanGetAppPath
|
||||||
LOCALFUNC tMacErr LoadMacRomFromAppPar(void)
|
LOCALFUNC tMacErr LoadMacRomFromAppPar(void)
|
||||||
{
|
{
|
||||||
tMacErr err;
|
tMacErr err;
|
||||||
char *d =
|
char *d =
|
||||||
#if CanGetAppPath
|
#ifdef CanGetAppPath
|
||||||
(NULL == d_arg) ? app_parent :
|
(NULL == d_arg) ? app_parent :
|
||||||
#endif
|
#endif
|
||||||
d_arg;
|
d_arg;
|
||||||
@ -1012,7 +1023,7 @@ LOCALFUNC bool LoadMacRom(void)
|
|||||||
|
|
||||||
if ((NULL == rom_path)
|
if ((NULL == rom_path)
|
||||||
|| (mnvm_fnfErr == (err = LoadMacRomFrom(rom_path))))
|
|| (mnvm_fnfErr == (err = LoadMacRomFrom(rom_path))))
|
||||||
#if CanGetAppPath
|
#ifdef CanGetAppPath
|
||||||
if (mnvm_fnfErr == (err = LoadMacRomFromAppPar()))
|
if (mnvm_fnfErr == (err = LoadMacRomFromAppPar()))
|
||||||
#endif
|
#endif
|
||||||
if (mnvm_fnfErr == (err = LoadMacRomFromHome()))
|
if (mnvm_fnfErr == (err = LoadMacRomFromHome()))
|
||||||
@ -1023,90 +1034,6 @@ LOCALFUNC bool LoadMacRom(void)
|
|||||||
return true; /* keep launching Mini vMac, regardless */
|
return true; /* keep launching Mini vMac, regardless */
|
||||||
}
|
}
|
||||||
|
|
||||||
#if UseActvFile
|
|
||||||
|
|
||||||
#define ActvCodeFileName "act_1"
|
|
||||||
|
|
||||||
LOCALFUNC tMacErr ActvCodeFileLoad(uint8_t * p)
|
|
||||||
{
|
|
||||||
tMacErr err;
|
|
||||||
char *s;
|
|
||||||
char *t = NULL;
|
|
||||||
char *t2 = NULL;
|
|
||||||
char *t3 = NULL;
|
|
||||||
|
|
||||||
if (mnvm_noErr == (err = FindUserHomeFolder(&s)))
|
|
||||||
if (mnvm_noErr == (err = ChildPath(s, ".gryphel", &t)))
|
|
||||||
if (mnvm_noErr == (err = ChildPath(t, "mnvm_act", &t2)))
|
|
||||||
if (mnvm_noErr == (err = ChildPath(t2, ActvCodeFileName, &t3)))
|
|
||||||
{
|
|
||||||
FILE *Actv_File;
|
|
||||||
int File_Size;
|
|
||||||
|
|
||||||
Actv_File = fopen(t3, "rb");
|
|
||||||
if (NULL == Actv_File) {
|
|
||||||
err = mnvm_fnfErr;
|
|
||||||
} else {
|
|
||||||
File_Size = fread(p, 1, ActvCodeFileLen, Actv_File);
|
|
||||||
if (File_Size != ActvCodeFileLen) {
|
|
||||||
if (feof(Actv_File)) {
|
|
||||||
err = mnvm_eofErr;
|
|
||||||
} else {
|
|
||||||
err = mnvm_miscErr;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
err = mnvm_noErr;
|
|
||||||
}
|
|
||||||
fclose(Actv_File);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MayFree(t3);
|
|
||||||
MayFree(t2);
|
|
||||||
MayFree(t);
|
|
||||||
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
LOCALFUNC tMacErr ActvCodeFileSave(uint8_t * p)
|
|
||||||
{
|
|
||||||
tMacErr err;
|
|
||||||
char *s;
|
|
||||||
char *t = NULL;
|
|
||||||
char *t2 = NULL;
|
|
||||||
char *t3 = NULL;
|
|
||||||
|
|
||||||
if (mnvm_noErr == (err = FindUserHomeFolder(&s)))
|
|
||||||
if (mnvm_noErr == (err = FindOrMakeChild(s, ".gryphel", &t)))
|
|
||||||
if (mnvm_noErr == (err = FindOrMakeChild(t, "mnvm_act", &t2)))
|
|
||||||
if (mnvm_noErr == (err = ChildPath(t2, ActvCodeFileName, &t3)))
|
|
||||||
{
|
|
||||||
FILE *Actv_File;
|
|
||||||
int File_Size;
|
|
||||||
|
|
||||||
Actv_File = fopen(t3, "wb+");
|
|
||||||
if (NULL == Actv_File) {
|
|
||||||
err = mnvm_fnfErr;
|
|
||||||
} else {
|
|
||||||
File_Size = fwrite(p, 1, ActvCodeFileLen, Actv_File);
|
|
||||||
if (File_Size != ActvCodeFileLen) {
|
|
||||||
err = mnvm_miscErr;
|
|
||||||
} else {
|
|
||||||
err = mnvm_noErr;
|
|
||||||
}
|
|
||||||
fclose(Actv_File);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MayFree(t3);
|
|
||||||
MayFree(t2);
|
|
||||||
MayFree(t);
|
|
||||||
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* UseActvFile */
|
|
||||||
|
|
||||||
/* --- video out --- */
|
/* --- video out --- */
|
||||||
|
|
||||||
LOCALVAR Window main_wind = 0;
|
LOCALVAR Window main_wind = 0;
|
||||||
@ -2512,7 +2439,8 @@ LOCALPROC Sound_SecondNotify0(void)
|
|||||||
|
|
||||||
#define SOUND_SAMPLERATE 22255 /* = round(7833600 * 2 / 704) */
|
#define SOUND_SAMPLERATE 22255 /* = round(7833600 * 2 / 704) */
|
||||||
|
|
||||||
#include "SOUNDGLU.h"
|
//#include "SOUNDGLU.h"
|
||||||
|
#include "HW/SOUND/SGLUALSA.h"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -3627,7 +3555,7 @@ LOCALFUNC bool CreateMainWindow(void)
|
|||||||
} else {
|
} else {
|
||||||
char *win_name =
|
char *win_name =
|
||||||
(NULL != n_arg) ? n_arg : (
|
(NULL != n_arg) ? n_arg : (
|
||||||
#if CanGetAppPath
|
#ifdef CanGetAppPath
|
||||||
(NULL != app_name) ? app_name :
|
(NULL != app_name) ? app_name :
|
||||||
#endif
|
#endif
|
||||||
kStrAppName);
|
kStrAppName);
|
||||||
@ -4557,7 +4485,7 @@ LOCALPROC UnallocMemory(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HaveAppPathLink
|
#ifdef HaveAppPathLink
|
||||||
LOCALFUNC bool ReadLink_Alloc(char *path, char **r)
|
LOCALFUNC bool ReadLink_Alloc(char *path, char **r)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@ -4612,7 +4540,7 @@ label_retry:
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HaveSysctlPath
|
#ifdef HaveSysctlPath
|
||||||
LOCALFUNC bool ReadKernProcPathname(char **r)
|
LOCALFUNC bool ReadKernProcPathname(char **r)
|
||||||
{
|
{
|
||||||
size_t s_alloc;
|
size_t s_alloc;
|
||||||
@ -4652,7 +4580,7 @@ LOCALFUNC bool ReadKernProcPathname(char **r)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if CanGetAppPath
|
#ifdef CanGetAppPath
|
||||||
LOCALFUNC bool Path2ParentAndName(char *path,
|
LOCALFUNC bool Path2ParentAndName(char *path,
|
||||||
char **parent, char **name)
|
char **parent, char **name)
|
||||||
{
|
{
|
||||||
@ -4696,16 +4624,16 @@ LOCALFUNC bool Path2ParentAndName(char *path,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if CanGetAppPath
|
#ifdef CanGetAppPath
|
||||||
LOCALFUNC bool InitWhereAmI(void)
|
LOCALFUNC bool InitWhereAmI(void)
|
||||||
{
|
{
|
||||||
char *s;
|
char *s;
|
||||||
|
|
||||||
if (!
|
if (!
|
||||||
#if HaveAppPathLink
|
#ifdef HaveAppPathLink
|
||||||
ReadLink_Alloc(TheAppPathLink, &s)
|
ReadLink_Alloc(TheAppPathLink, &s)
|
||||||
#endif
|
#endif
|
||||||
#if HaveSysctlPath
|
#ifdef HaveSysctlPath
|
||||||
ReadKernProcPathname(&s)
|
ReadKernProcPathname(&s)
|
||||||
#endif
|
#endif
|
||||||
)
|
)
|
||||||
@ -4729,7 +4657,7 @@ LOCALFUNC bool InitWhereAmI(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if CanGetAppPath
|
#ifdef CanGetAppPath
|
||||||
LOCALPROC UninitWhereAmI(void)
|
LOCALPROC UninitWhereAmI(void)
|
||||||
{
|
{
|
||||||
MayFree(app_parent);
|
MayFree(app_parent);
|
||||||
@ -4740,7 +4668,7 @@ LOCALPROC UninitWhereAmI(void)
|
|||||||
LOCALFUNC bool InitOSGLU(void)
|
LOCALFUNC bool InitOSGLU(void)
|
||||||
{
|
{
|
||||||
if (AllocMemory())
|
if (AllocMemory())
|
||||||
#if CanGetAppPath
|
#ifdef CanGetAppPath
|
||||||
if (InitWhereAmI())
|
if (InitWhereAmI())
|
||||||
#endif
|
#endif
|
||||||
#if dbglog_HAVE
|
#if dbglog_HAVE
|
||||||
@ -4810,7 +4738,7 @@ LOCALPROC UnInitOSGLU(void)
|
|||||||
dbglog_close();
|
dbglog_close();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if CanGetAppPath
|
#ifdef CanGetAppPath
|
||||||
UninitWhereAmI();
|
UninitWhereAmI();
|
||||||
#endif
|
#endif
|
||||||
UnallocMemory();
|
UnallocMemory();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user