mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-07 14:23:29 -04:00
3DS: Bind stick input to left pad axis instead (so moves player), double GPU command buffer size
Also implement thread naming on BSD systems
This commit is contained in:
parent
d7b805a480
commit
02b068c7dc
@ -19,7 +19,7 @@
|
||||
#endif
|
||||
|
||||
int Audio_SoundsVolume, Audio_MusicVolume;
|
||||
const cc_string Sounds_ZipPathMC = String_FromConst("audio/default.zip");
|
||||
const cc_string Sounds_ZipPathMC = String_FromConst("audio/default.zip");
|
||||
const cc_string Sounds_ZipPathCC = String_FromConst("audio/classicube.zip");
|
||||
static const cc_string audio_dir = String_FromConst("audio");
|
||||
|
||||
|
@ -1126,7 +1126,7 @@ void ZLib_MakeStream(struct Stream* stream, struct ZLibState* state, struct Stre
|
||||
/*########################################################################################################################*
|
||||
*--------------------------------------------------------ZipReader--------------------------------------------------------*
|
||||
*#########################################################################################################################*/
|
||||
#define ZIP_MAXNAMELEN 512
|
||||
#define ZIP_MAXNAMELEN 512
|
||||
#define ZIP_MAX_ENTRIES 1024
|
||||
|
||||
/* Stores state for reading and processing entries in a .zip archive */
|
||||
@ -1216,7 +1216,6 @@ static cc_result Zip_ReadCentralDirectory(struct ZipState* state) {
|
||||
if (state->usedEntries >= ZIP_MAX_ENTRIES) return ZIP_ERR_TOO_MANY_ENTRIES;
|
||||
entry = &state->entries[state->usedEntries++];
|
||||
|
||||
entry->CRC32 = Stream_GetU32_LE(&header[12]);
|
||||
entry->CompressedSize = Stream_GetU32_LE(&header[16]);
|
||||
entry->UncompressedSize = Stream_GetU32_LE(&header[20]);
|
||||
entry->LocalHeaderOffset = Stream_GetU32_LE(&header[38]);
|
||||
|
@ -120,7 +120,7 @@ CC_API void ZLib_MakeStream( struct Stream* stream, struct ZLibState* stat
|
||||
typedef void (*FP_ZLib_MakeStream)(struct Stream* stream, struct ZLibState* state, struct Stream* underlying);
|
||||
|
||||
/* Minimal data needed to describe an entry in a .zip archive */
|
||||
struct ZipEntry { cc_uint32 CompressedSize, UncompressedSize, LocalHeaderOffset, CRC32; };
|
||||
struct ZipEntry { cc_uint32 CompressedSize, UncompressedSize, LocalHeaderOffset; };
|
||||
/* Callback function to process the data in a .zip archive entry */
|
||||
/* Return non-zero to indicate an error and stop further processing */
|
||||
/* NOTE: data stream MAY NOT be seekable (i.e. entry data might be compressed) */
|
||||
|
@ -129,7 +129,7 @@ static void SetDefaultState(void) {
|
||||
}
|
||||
|
||||
static void InitCitro3D(void) {
|
||||
C3D_Init(C3D_DEFAULT_CMDBUF_SIZE);
|
||||
C3D_Init(C3D_DEFAULT_CMDBUF_SIZE * 2);
|
||||
|
||||
topTarget = C3D_RenderTargetCreate(240, 400, GPU_RB_RGBA8, GPU_RB_DEPTH24_STENCIL8);
|
||||
C3D_RenderTargetSetOutput(topTarget, GFX_TOP, GFX_LEFT, DISPLAY_TRANSFER_FLAGS);
|
||||
|
@ -344,10 +344,16 @@ void Thread_Run(void** handle, Thread_StartFunc func, int stackSize, const char*
|
||||
if (res) Logger_Abort2(res, "Creating thread");
|
||||
pthread_attr_destroy(&attrs);
|
||||
|
||||
#if defined CC_BUILD_LINUX || defined CC_BUILD_HAIKU
|
||||
extern int pthread_setname_np(pthread_t thread, const char *name);
|
||||
#if defined CC_BUILD_LINUX || defined CC_BUILD_HAIKU
|
||||
extern int pthread_setname_np(pthread_t thread, const char* name);
|
||||
pthread_setname_np(*ptr, name);
|
||||
#endif
|
||||
#elif defined CC_BUILD_FREEBSD || defined CC_BUILD_OPENBSD
|
||||
extern int pthread_set_name_np(pthread_t thread, const char* name);
|
||||
pthread_set_name_np(*ptr, name);
|
||||
#elif defined CC_BUILD_NETBSD
|
||||
extern int pthread_setname_np(pthread_t thread, const char* fmt, const char* arg);
|
||||
pthread_setname_np(*ptr, "%s", name);
|
||||
#endif
|
||||
}
|
||||
|
||||
void Thread_Detach(void* handle) {
|
||||
|
@ -110,12 +110,12 @@ static void HandleButtons(u32 mods) {
|
||||
}
|
||||
|
||||
#define AXIS_SCALE 8.0f
|
||||
static void ProcessJoystickInput(circlePosition* pos, double delta) {
|
||||
static void ProcessCircleInput(int axis, circlePosition* pos, double delta) {
|
||||
// May not be exactly 0 on actual hardware
|
||||
if (Math_AbsI(pos->dx) <= 16) pos->dx = 0;
|
||||
if (Math_AbsI(pos->dy) <= 16) pos->dy = 0;
|
||||
|
||||
Gamepad_SetAxis(PAD_AXIS_RIGHT, pos->dx / AXIS_SCALE, -pos->dy / AXIS_SCALE, delta);
|
||||
Gamepad_SetAxis(axis, pos->dx / AXIS_SCALE, -pos->dy / AXIS_SCALE, delta);
|
||||
}
|
||||
|
||||
static void ProcessTouchInput(int mods) {
|
||||
@ -143,16 +143,15 @@ void Window_ProcessEvents(double delta) {
|
||||
|
||||
ProcessTouchInput(mods);
|
||||
|
||||
if (Input.RawMode) {
|
||||
circlePosition pos;
|
||||
hidCircleRead(&pos);
|
||||
ProcessJoystickInput(&pos, delta);
|
||||
}
|
||||
if (Input.RawMode && irrst_result == 0) {
|
||||
circlePosition pos;
|
||||
circlePosition hid_pos;
|
||||
hidCircleRead(&hid_pos);
|
||||
ProcessCircleInput(PAD_AXIS_RIGHT, &hid_pos, delta);
|
||||
|
||||
if (irrst_result == 0) {
|
||||
circlePosition stk_pos;
|
||||
irrstScanInput();
|
||||
irrstCstickRead(&pos);
|
||||
ProcessJoystickInput(&pos, delta);
|
||||
irrstCstickRead(&stk_pos);
|
||||
ProcessCircleInput(PAD_AXIS_LEFT, &stk_pos, delta);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user