mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-01-22 09:01:57 -05:00
Open source unfinished 360 stuff, fix some depth issues with xbox build
This commit is contained in:
parent
466bc0134b
commit
e6d1f593d2
7 changed files with 607 additions and 5 deletions
10
Makefile
10
Makefile
|
@ -145,18 +145,20 @@ irix:
|
|||
# separate makefiles to avoid having one giant messy makefile
|
||||
psp:
|
||||
$(MAKE) -f src/Makefile_PSP PLAT=psp
|
||||
vita:
|
||||
$(MAKE) -f src/Makefile_vita PLAT=vita
|
||||
3ds:
|
||||
$(MAKE) -f src/Makefile_3DS PLAT=3ds
|
||||
wii:
|
||||
$(MAKE) -f src/Makefile_wii PLAT=wii
|
||||
gamecube:
|
||||
$(MAKE) -f src/Makefile_gamecube PLAT=gamecube
|
||||
xbox:
|
||||
$(MAKE) -f src/Makefile_xbox PLAT=xbox
|
||||
vita:
|
||||
$(MAKE) -f src/Makefile_vita PLAT=vita
|
||||
dreamcast:
|
||||
$(MAKE) -f src/Makefile_dreamcast PLAT=dreamcast
|
||||
xbox:
|
||||
$(MAKE) -f src/Makefile_xbox PLAT=xbox
|
||||
xbox360:
|
||||
$(MAKE) -f src/Makefile_xbox PLAT=xbox360
|
||||
|
||||
clean:
|
||||
$(DEL) $(OBJECTS)
|
||||
|
|
|
@ -129,6 +129,14 @@ typedef cc_uint8 cc_bool;
|
|||
#define CC_BUILD_LOWMEM
|
||||
#define CC_BUILD_HTTPCLIENT
|
||||
#undef CC_BUILD_FREETYPE
|
||||
#elif defined XENON
|
||||
/* libxenon also defines __linux__ (yes, really) */
|
||||
#define CC_BUILD_XBOX360
|
||||
#define CC_BUILD_NOMUSIC
|
||||
#define CC_BUILD_NOSOUNDS
|
||||
#define CC_BUILD_LOWMEM
|
||||
#define CC_BUILD_HTTPCLIENT
|
||||
#undef CC_BUILD_FREETYPE
|
||||
#elif defined _WIN32
|
||||
#define CC_BUILD_WIN
|
||||
#define CC_BUILD_D3D9
|
||||
|
|
|
@ -546,7 +546,7 @@ void Gfx_LoadMatrix(MatrixType type, const struct Matrix* matrix) {
|
|||
p = pb_begin();
|
||||
|
||||
// resets "z perspective" flag
|
||||
//p = pb_push1(p, NV097_SET_CONTROL0, 0);
|
||||
p = pb_push1(p, NV097_SET_CONTROL0, 0);
|
||||
|
||||
// set shader constants cursor to C0
|
||||
p = pb_push1(p, NV097_SET_TRANSFORM_CONSTANT_LOAD, 96);
|
||||
|
|
117
src/Makefile_xbox360
Normal file
117
src/Makefile_xbox360
Normal file
|
@ -0,0 +1,117 @@
|
|||
#---------------------------------------------------------------------------------
|
||||
# Clear the implicit built in rules
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(DEVKITXENON)),)
|
||||
$(error "Please set DEVKITXENON in your environment. export DEVKITXENON=<path to>devkitPPC")
|
||||
endif
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
export LIBXENON_INC := $(DEVKITXENON)/usr/include
|
||||
export LIBXENON_LIB := $(DEVKITXENON)/usr/lib
|
||||
LDSCRIPT := $(DEVKITXENON)/app.lds
|
||||
|
||||
MACHDEP = -DXENON -m32 -maltivec -fno-pic -mpowerpc64 -mhard-float -L$(DEVKITXENON)/xenon/lib/32
|
||||
|
||||
export AS := xenon-as
|
||||
export CC := xenon-gcc
|
||||
export CXX := xenon-g++
|
||||
export AR := xenon-ar
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# TARGET is the name of the output
|
||||
# BUILD is the directory where object files & intermediate files will be placed
|
||||
# SOURCES is a list of directories containing source code
|
||||
# INCLUDES is a list of directories containing extra header files
|
||||
#---------------------------------------------------------------------------------
|
||||
TARGET := ClassiCube-xbox360
|
||||
BUILD := build
|
||||
SOURCES := src
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE)
|
||||
CXXFLAGS= $(CFLAGS)
|
||||
|
||||
LDFLAGS = -g $(MACHDEP) -Wl,--gc-sections -Wl,-Map,$(notdir $@).map
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with the project
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS := -lxenon -lm
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# list of directories containing libraries, this must be the top level containing
|
||||
# include and lib
|
||||
#---------------------------------------------------------------------------------
|
||||
export OUTPUT := $(CURDIR)/$(TARGET)
|
||||
|
||||
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir))
|
||||
|
||||
export DEPSDIR := $(CURDIR)/$(BUILD)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# automatically build a list of object files for our project
|
||||
#---------------------------------------------------------------------------------
|
||||
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
|
||||
sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
||||
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
|
||||
|
||||
export LD := $(CC)
|
||||
export OFILES := $(CFILES:.c=.o) $(sFILES:.s=.o) $(SFILES:.S=.o)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# build a list of include paths
|
||||
#---------------------------------------------------------------------------------
|
||||
export INCLUDE := -I$(LIBXENON_INC)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# build a list of library paths
|
||||
#---------------------------------------------------------------------------------
|
||||
export LIBPATHS := -L$(LIBXENON_LIB)
|
||||
|
||||
export OUTPUT := $(CURDIR)/$(TARGET)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# main targets
|
||||
#---------------------------------------------------------------------------------
|
||||
$(OUTPUT).elf32: $(OUTPUT).elf
|
||||
$(OUTPUT).elf: $(OFILES)
|
||||
|
||||
default: $(BUILD) $(OUTPUT).elf32
|
||||
cp $(OUTPUT).elf32 /tftpboot/xenon
|
||||
xenon-strip /tftpboot/xenon
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
$(BUILD):
|
||||
@[ -d $@ ] || mkdir -p $@
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
clean:
|
||||
@echo clean ...
|
||||
@rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).elf32
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.o: %.c
|
||||
@$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
%.o: %.s
|
||||
@$(CC) -x assembler-with-cpp $(ASFLAGS) -c $< -o $@
|
||||
|
||||
%.o: %.S
|
||||
@$(CC) -x assembler-with-cpp $(ASFLAGS) -c $< -o $@
|
||||
|
||||
%.elf:
|
||||
@echo linking ... $(notdir $@)
|
||||
@$(LD) $^ $(LDFLAGS) $(LIBPATHS) $(LIBS) -n -T $(LDSCRIPT) -o $@
|
||||
|
||||
%.elf32: %.elf
|
||||
@echo converting and stripping ... $(notdir $@)
|
||||
@xenon-objcopy -O elf32-powerpc --adjust-vma 0x80000000 $< $@
|
||||
@xenon-strip $@
|
299
src/Platform_Xbox360.c
Normal file
299
src/Platform_Xbox360.c
Normal file
|
@ -0,0 +1,299 @@
|
|||
#include "Core.h"
|
||||
#if defined CC_BUILD_XBOX360
|
||||
#include "_PlatformBase.h"
|
||||
#include "Stream.h"
|
||||
#include "Funcs.h"
|
||||
#include "Utils.h"
|
||||
#include "Errors.h"
|
||||
|
||||
#define LWIP_SOCKET 1
|
||||
#include <lwip/sockets.h>
|
||||
#include <xenos/xe.h>
|
||||
#include <xenos/xenos.h>
|
||||
#include <xenos/edram.h>
|
||||
#include <console/console.h>
|
||||
#include <network/network.h>
|
||||
#include <time/time.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <dirent.h>
|
||||
#include <fcntl.h>
|
||||
#include "_PlatformConsole.h"
|
||||
|
||||
const cc_result ReturnCode_FileShareViolation = 1000000000; /* TODO: not used apparently */
|
||||
const cc_result ReturnCode_FileNotFound = ENOENT;
|
||||
const cc_result ReturnCode_SocketInProgess = EINPROGRESS;
|
||||
const cc_result ReturnCode_SocketWouldBlock = EWOULDBLOCK;
|
||||
const cc_result ReturnCode_DirectoryExists = EEXIST;
|
||||
const char* Platform_AppNameSuffix = " XBox 360";
|
||||
|
||||
|
||||
/*########################################################################################################################*
|
||||
*------------------------------------------------------Logging/Time-------------------------------------------------------*
|
||||
*#########################################################################################################################*/
|
||||
void Platform_Log(const char* msg, int len) {
|
||||
char tmp[2048 + 1];
|
||||
len = min(len, 2048);
|
||||
Mem_Copy(tmp, msg, len); tmp[len] = '\0';
|
||||
|
||||
puts(tmp);
|
||||
}
|
||||
|
||||
#define UnixTime_TotalMS(time) ((cc_uint64)time.tv_sec * 1000 + UNIX_EPOCH + (time.tv_usec / 1000))
|
||||
TimeMS DateTime_CurrentUTC_MS(void) {
|
||||
struct timeval cur;
|
||||
gettimeofday(&cur, NULL);
|
||||
return UnixTime_TotalMS(cur);
|
||||
}
|
||||
|
||||
void DateTime_CurrentLocal(struct DateTime* t) {
|
||||
struct timeval cur;
|
||||
struct tm loc_time;
|
||||
gettimeofday(&cur, NULL);
|
||||
localtime_r(&cur.tv_sec, &loc_time);
|
||||
|
||||
t->year = loc_time.tm_year + 1900;
|
||||
t->month = loc_time.tm_mon + 1;
|
||||
t->day = loc_time.tm_mday;
|
||||
t->hour = loc_time.tm_hour;
|
||||
t->minute = loc_time.tm_min;
|
||||
t->second = loc_time.tm_sec;
|
||||
}
|
||||
|
||||
cc_uint64 Stopwatch_ElapsedMicroseconds(cc_uint64 beg, cc_uint64 end) {
|
||||
if (end < beg) return 0;
|
||||
return (end - beg);
|
||||
}
|
||||
|
||||
#define US_PER_SEC 1000000ULL
|
||||
cc_uint64 Stopwatch_Measure(void) {
|
||||
struct timeval cur;
|
||||
gettimeofday(&cur, NULL);
|
||||
return cur.tv_sec * US_PER_SEC + cur.tv_usec;
|
||||
// TODO: <ppc/timebase.h>
|
||||
// mftb()-beg)/PPC_TIMEBASE_FREQ));
|
||||
}
|
||||
|
||||
|
||||
/*########################################################################################################################*
|
||||
*-----------------------------------------------------Directory/File------------------------------------------------------*
|
||||
*#########################################################################################################################*/
|
||||
static char root_buffer[NATIVE_STR_LEN];
|
||||
static cc_string root_path = String_FromArray(root_buffer);
|
||||
|
||||
static void GetNativePath(char* str, const cc_string* path) {
|
||||
Mem_Copy(str, root_path.buffer, root_path.length);
|
||||
str += root_path.length;
|
||||
String_EncodeUtf8(str, path);
|
||||
}
|
||||
|
||||
cc_result Directory_Create(const cc_string* path) {
|
||||
char str[NATIVE_STR_LEN];
|
||||
GetNativePath(str, path);
|
||||
return mkdir(str, 0) == -1 ? errno : 0;
|
||||
}
|
||||
|
||||
int File_Exists(const cc_string* path) {
|
||||
char str[NATIVE_STR_LEN];
|
||||
struct stat sb;
|
||||
GetNativePath(str, path);
|
||||
return stat(str, &sb) == 0 && S_ISREG(sb.st_mode);
|
||||
}
|
||||
|
||||
cc_result Directory_Enum(const cc_string* dirPath, void* obj, Directory_EnumCallback callback) {
|
||||
cc_string path; char pathBuffer[FILENAME_SIZE];
|
||||
char str[NATIVE_STR_LEN];
|
||||
struct dirent* entry;
|
||||
int res;
|
||||
|
||||
GetNativePath(str, dirPath);
|
||||
DIR* dirPtr = opendir(str);
|
||||
if (!dirPtr) return errno;
|
||||
|
||||
// POSIX docs: "When the end of the directory is encountered, a null pointer is returned and errno is not changed."
|
||||
// errno is sometimes leftover from previous calls, so always reset it before readdir gets called
|
||||
errno = 0;
|
||||
String_InitArray(path, pathBuffer);
|
||||
|
||||
while ((entry = readdir(dirPtr))) {
|
||||
path.length = 0;
|
||||
String_Format1(&path, "%s/", dirPath);
|
||||
|
||||
// ignore . and .. entry
|
||||
char* src = entry->d_name;
|
||||
if (src[0] == '.' && src[1] == '\0') continue;
|
||||
if (src[0] == '.' && src[1] == '.' && src[2] == '\0') continue;
|
||||
|
||||
int len = String_Length(src);
|
||||
String_AppendUtf8(&path, src, len);
|
||||
int is_dir = entry->d_type == DT_DIR;
|
||||
// TODO: fallback to stat when this fails
|
||||
|
||||
if (is_dir) {
|
||||
res = Directory_Enum(&path, obj, callback);
|
||||
if (res) { closedir(dirPtr); return res; }
|
||||
} else {
|
||||
callback(&path, obj);
|
||||
}
|
||||
errno = 0;
|
||||
}
|
||||
|
||||
res = errno; // return code from readdir
|
||||
closedir(dirPtr);
|
||||
return res;
|
||||
}
|
||||
|
||||
static cc_result File_Do(cc_file* file, const cc_string* path, int mode) {
|
||||
char str[NATIVE_STR_LEN];
|
||||
GetNativePath(str, path);
|
||||
*file = open(str, mode, 0);
|
||||
return *file == -1 ? errno : 0;
|
||||
}
|
||||
|
||||
cc_result File_Open(cc_file* file, const cc_string* path) {
|
||||
return File_Do(file, path, O_RDONLY);
|
||||
}
|
||||
cc_result File_Create(cc_file* file, const cc_string* path) {
|
||||
return File_Do(file, path, O_RDWR | O_CREAT | O_TRUNC);
|
||||
}
|
||||
cc_result File_OpenOrCreate(cc_file* file, const cc_string* path) {
|
||||
return File_Do(file, path, O_RDWR | O_CREAT);
|
||||
}
|
||||
|
||||
cc_result File_Read(cc_file file, void* data, cc_uint32 count, cc_uint32* bytesRead) {
|
||||
*bytesRead = read(file, data, count);
|
||||
return *bytesRead == -1 ? errno : 0;
|
||||
}
|
||||
|
||||
cc_result File_Write(cc_file file, const void* data, cc_uint32 count, cc_uint32* bytesWrote) {
|
||||
*bytesWrote = write(file, data, count);
|
||||
return *bytesWrote == -1 ? errno : 0;
|
||||
}
|
||||
|
||||
cc_result File_Close(cc_file file) {
|
||||
return close(file) == -1 ? errno : 0;
|
||||
}
|
||||
|
||||
cc_result File_Seek(cc_file file, int offset, int seekType) {
|
||||
static cc_uint8 modes[3] = { SEEK_SET, SEEK_CUR, SEEK_END };
|
||||
return lseek(file, offset, modes[seekType]) == -1 ? errno : 0;
|
||||
}
|
||||
|
||||
cc_result File_Position(cc_file file, cc_uint32* pos) {
|
||||
*pos = lseek(file, 0, SEEK_CUR);
|
||||
return *pos == -1 ? errno : 0;
|
||||
}
|
||||
|
||||
cc_result File_Length(cc_file file, cc_uint32* len) {
|
||||
struct stat st;
|
||||
if (fstat(file, &st) == -1) { *len = -1; return errno; }
|
||||
*len = st.st_size; return 0;
|
||||
}
|
||||
|
||||
/*########################################################################################################################*
|
||||
*--------------------------------------------------------Threading--------------------------------------------------------*
|
||||
*#############################################################################################################p############*/
|
||||
void Thread_Sleep(cc_uint32 milliseconds) { mdelay(milliseconds); }
|
||||
|
||||
void* Thread_Create(Thread_StartFunc func) {
|
||||
return NULL; // TODO
|
||||
}
|
||||
|
||||
void Thread_Start2(void* handle, Thread_StartFunc func) {// TODO
|
||||
}
|
||||
|
||||
void Thread_Detach(void* handle) {// TODO
|
||||
}
|
||||
|
||||
void Thread_Join(void* handle) {// TODO
|
||||
}
|
||||
|
||||
void* Mutex_Create(void) {
|
||||
return Mem_AllocCleared(1, sizeof(int), "mutex");
|
||||
}
|
||||
|
||||
void Mutex_Free(void* handle) {
|
||||
Mem_Free(handle);
|
||||
}
|
||||
void Mutex_Lock(void* handle) { } // TODO
|
||||
void Mutex_Unlock(void* handle) { } // TODO
|
||||
|
||||
void* Waitable_Create(void) {
|
||||
return NULL; // TODO
|
||||
}
|
||||
|
||||
void Waitable_Free(void* handle) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
void Waitable_Signal(void* handle) { } // TODO }
|
||||
void Waitable_Wait(void* handle) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
void Waitable_WaitFor(void* handle, cc_uint32 milliseconds) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
|
||||
/*########################################################################################################################*
|
||||
*---------------------------------------------------------Socket----------------------------------------------------------*
|
||||
*#########################################################################################################################*/
|
||||
int Socket_ValidAddress(const cc_string* address) {
|
||||
return false;
|
||||
}
|
||||
|
||||
cc_result Socket_Connect(cc_socket* s, const cc_string* address, int port, cc_bool nonblocking) {
|
||||
return ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
cc_result Socket_Read(cc_socket s, cc_uint8* data, cc_uint32 count, cc_uint32* modified) {
|
||||
return ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
cc_result Socket_Write(cc_socket s, const cc_uint8* data, cc_uint32 count, cc_uint32* modified) {
|
||||
return ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
void Socket_Close(cc_socket s) {
|
||||
}
|
||||
|
||||
cc_result Socket_CheckReadable(cc_socket s, cc_bool* readable) {
|
||||
return ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
cc_result Socket_CheckWritable(cc_socket s, cc_bool* writable) {
|
||||
return ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
/*########################################################################################################################*
|
||||
*--------------------------------------------------------Platform---------------------------------------------------------*
|
||||
*#########################################################################################################################*/
|
||||
cc_result Process_StartOpen(const cc_string* args) {
|
||||
return ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
void Platform_Init(void) {
|
||||
xenos_init(VIDEO_MODE_AUTO);
|
||||
console_init();
|
||||
//network_init();
|
||||
}
|
||||
|
||||
void Platform_Free(void) {
|
||||
}
|
||||
|
||||
cc_bool Platform_DescribeError(cc_result res, cc_string* dst) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/*########################################################################################################################*
|
||||
*-------------------------------------------------------Encryption--------------------------------------------------------*
|
||||
*#########################################################################################################################*/
|
||||
static cc_result GetMachineID(cc_uint32* key) {
|
||||
return ERR_NOT_SUPPORTED;
|
||||
}
|
||||
#endif
|
176
src/Window_Xbox360.c
Normal file
176
src/Window_Xbox360.c
Normal file
|
@ -0,0 +1,176 @@
|
|||
#include "Core.h"
|
||||
#if defined CC_BUILD_XBOX360
|
||||
#include "Window.h"
|
||||
#include "Platform.h"
|
||||
#include "Input.h"
|
||||
#include "Event.h"
|
||||
#include "Graphics.h"
|
||||
#include "String.h"
|
||||
#include "Funcs.h"
|
||||
#include "Bitmap.h"
|
||||
#include "Errors.h"
|
||||
#include "ExtMath.h"
|
||||
#include <xenos/xenos.h>
|
||||
#include <input/input.h>
|
||||
#include <usb/usbmain.h>
|
||||
|
||||
static cc_bool launcherMode;
|
||||
|
||||
struct _DisplayData DisplayInfo;
|
||||
struct _WinData WindowInfo;
|
||||
// no DPI scaling on Xbox
|
||||
int Display_ScaleX(int x) { return x; }
|
||||
int Display_ScaleY(int y) { return y; }
|
||||
|
||||
// https://github.com/Free60Project/libxenon/blob/71a411cddfc26c9ccade08d054d87180c359797a/libxenon/drivers/console/console.c#L47
|
||||
struct ati_info {
|
||||
uint32_t unknown1[4];
|
||||
uint32_t base;
|
||||
uint32_t unknown2[8];
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
} __attribute__ ((__packed__)) ;
|
||||
|
||||
void Window_Init(void) {
|
||||
struct ati_info* ai = (struct ati_info*)0xec806100ULL;
|
||||
|
||||
DisplayInfo.Width = ai->width;
|
||||
DisplayInfo.Height = ai->height;
|
||||
DisplayInfo.Depth = 4; // 32 bit
|
||||
DisplayInfo.ScaleX = 1;
|
||||
DisplayInfo.ScaleY = 1;
|
||||
|
||||
WindowInfo.Width = ai->width;
|
||||
WindowInfo.Height = ai->height;
|
||||
WindowInfo.Focused = true;
|
||||
WindowInfo.Exists = true;
|
||||
|
||||
Input.GamepadSource = true;
|
||||
|
||||
usb_init();
|
||||
usb_do_poll();
|
||||
|
||||
//xenon_ata_init();
|
||||
//xenon_atapi_init();
|
||||
}
|
||||
|
||||
void Window_Create2D(int width, int height) { launcherMode = true; }
|
||||
void Window_Create3D(int width, int height) { launcherMode = false; }
|
||||
|
||||
void Window_SetTitle(const cc_string* title) { }
|
||||
void Clipboard_GetText(cc_string* value) { }
|
||||
void Clipboard_SetText(const cc_string* value) { }
|
||||
|
||||
int Window_GetWindowState(void) { return WINDOW_STATE_FULLSCREEN; }
|
||||
cc_result Window_EnterFullscreen(void) { return 0; }
|
||||
cc_result Window_ExitFullscreen(void) { return 0; }
|
||||
int Window_IsObscured(void) { return 0; }
|
||||
|
||||
void Window_Show(void) { }
|
||||
void Window_SetSize(int width, int height) { }
|
||||
|
||||
void Window_Close(void) {
|
||||
/* TODO implement */
|
||||
}
|
||||
|
||||
|
||||
/*########################################################################################################################*
|
||||
*----------------------------------------------------Input processing-----------------------------------------------------*
|
||||
*#########################################################################################################################*/
|
||||
/*
|
||||
struct controller_data_s
|
||||
{
|
||||
signed short s1_x, s1_y, s2_x, s2_y;
|
||||
int s1_z, s2_z, lb, rb, start, back, a, b, x, y, up, down, left, right;
|
||||
unsigned char lt, rt;
|
||||
int logo;
|
||||
};
|
||||
*/
|
||||
|
||||
static void HandleButtons(struct controller_data_s* pad) {
|
||||
Input_SetNonRepeatable(CCPAD_L, pad->lb);
|
||||
Input_SetNonRepeatable(CCPAD_R, pad->rb);
|
||||
|
||||
Input_SetNonRepeatable(CCPAD_A, pad->a);
|
||||
Input_SetNonRepeatable(CCPAD_B, pad->b);
|
||||
Input_SetNonRepeatable(CCPAD_X, pad->x);
|
||||
Input_SetNonRepeatable(CCPAD_Y, pad->y);
|
||||
|
||||
Input_SetNonRepeatable(CCPAD_START, pad->start);
|
||||
Input_SetNonRepeatable(CCPAD_SELECT, pad->back);
|
||||
|
||||
Input_SetNonRepeatable(CCPAD_LEFT, pad->left);
|
||||
Input_SetNonRepeatable(CCPAD_RIGHT, pad->right);
|
||||
Input_SetNonRepeatable(CCPAD_UP, pad->up);
|
||||
Input_SetNonRepeatable(CCPAD_DOWN, pad->down);
|
||||
}
|
||||
|
||||
void Window_ProcessEvents(double delta) {
|
||||
usb_do_poll();
|
||||
|
||||
struct controller_data_s pad;
|
||||
int res = get_controller_data(&pad, 0);
|
||||
if (res == 0) return;
|
||||
|
||||
HandleButtons(&pad);
|
||||
}
|
||||
|
||||
void Cursor_SetPosition(int x, int y) { } // Makes no sense for Xbox
|
||||
|
||||
void Window_EnableRawMouse(void) { Input.RawMode = true; }
|
||||
void Window_DisableRawMouse(void) { Input.RawMode = false; }
|
||||
void Window_UpdateRawMouse(void) { }
|
||||
|
||||
|
||||
/*########################################################################################################################*
|
||||
*------------------------------------------------------Framebuffer--------------------------------------------------------*
|
||||
*#########################################################################################################################*/
|
||||
static struct Bitmap fb_bmp;
|
||||
void Window_AllocFramebuffer(struct Bitmap* bmp) {
|
||||
bmp->scan0 = (BitmapCol*)Mem_Alloc(bmp->width * bmp->height, 4, "window pixels");
|
||||
fb_bmp = *bmp;
|
||||
}
|
||||
|
||||
void Window_DrawFramebuffer(Rect2D r) {return;
|
||||
//void* fb = XVideoGetFB();
|
||||
//XVideoWaitForVBlank();
|
||||
|
||||
/*cc_uint32* src = (cc_uint32*)fb_bmp.scan0 + r.X;
|
||||
cc_uint32* dst = (cc_uint32*)fb + r.X;
|
||||
|
||||
for (int y = r.Y; y < r.Y + r.Height; y++)
|
||||
{
|
||||
Mem_Copy(dst + y * fb_bmp.width, src + y * fb_bmp.width, r.Width * 4);
|
||||
}*/
|
||||
}
|
||||
|
||||
void Window_FreeFramebuffer(struct Bitmap* bmp) {
|
||||
Mem_Free(bmp->scan0);
|
||||
}
|
||||
|
||||
|
||||
/*########################################################################################################################*
|
||||
*------------------------------------------------------Soft keyboard------------------------------------------------------*
|
||||
*#########################################################################################################################*/
|
||||
void Window_OpenKeyboard(struct OpenKeyboardArgs* args) { }
|
||||
void Window_SetKeyboardText(const cc_string* text) { }
|
||||
void Window_CloseKeyboard(void) { /* TODO implement */ }
|
||||
|
||||
|
||||
/*########################################################################################################################*
|
||||
*-------------------------------------------------------Misc/Other--------------------------------------------------------*
|
||||
*#########################################################################################################################*/
|
||||
void Window_ShowDialog(const char* title, const char* msg) {
|
||||
/* TODO implement */
|
||||
Platform_LogConst(title);
|
||||
Platform_LogConst(msg);
|
||||
}
|
||||
|
||||
cc_result Window_OpenFileDialog(const struct OpenFileDialogArgs* args) {
|
||||
return ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
cc_result Window_SaveFileDialog(const struct SaveFileDialogArgs* args) {
|
||||
return ERR_NOT_SUPPORTED;
|
||||
}
|
||||
#endif
|
Loading…
Reference in a new issue