diff options
| author | void_17 <heroerror3@gmail.com> | 2026-03-02 15:53:32 +0700 |
|---|---|---|
| committer | void_17 <heroerror3@gmail.com> | 2026-03-02 15:53:32 +0700 |
| commit | d63f79325f85e014361eb8cf1e41eaebedb1ae71 (patch) | |
| tree | d9f28714afd516bc2450f33b0a77c5e05ff4de90 /Minecraft.Client/PSVita | |
| parent | d6ec138710461294c3ffd2723bc8a9f212d3471f (diff) | |
Get rid of MSVC's __int64
Use either int64_t, uint64_t or long long and unsigned long long, defined as per C++11 standard
Diffstat (limited to 'Minecraft.Client/PSVita')
| -rw-r--r-- | Minecraft.Client/PSVita/Iggy/include/rrCore.h | 56 | ||||
| -rw-r--r-- | Minecraft.Client/PSVita/Miles/include/mss.h | 428 | ||||
| -rw-r--r-- | Minecraft.Client/PSVita/Miles/include/rrCore.h | 56 | ||||
| -rw-r--r-- | Minecraft.Client/PSVita/Network/SonyRemoteStorage_Vita.cpp | 62 | ||||
| -rw-r--r-- | Minecraft.Client/PSVita/PSVitaExtras/PSVitaStubs.h | 94 | ||||
| -rw-r--r-- | Minecraft.Client/PSVita/PSVitaExtras/PSVitaTypes.h | 4 | ||||
| -rw-r--r-- | Minecraft.Client/PSVita/PSVitaExtras/PsVitaStubs.cpp | 174 | ||||
| -rw-r--r-- | Minecraft.Client/PSVita/PSVitaExtras/libdivide.h | 292 | ||||
| -rw-r--r-- | Minecraft.Client/PSVita/PSVitaExtras/zconf.h | 2 | ||||
| -rw-r--r-- | Minecraft.Client/PSVita/PSVita_App.cpp | 96 |
10 files changed, 631 insertions, 633 deletions
diff --git a/Minecraft.Client/PSVita/Iggy/include/rrCore.h b/Minecraft.Client/PSVita/Iggy/include/rrCore.h index e88b5f8c..17ebee3a 100644 --- a/Minecraft.Client/PSVita/Iggy/include/rrCore.h +++ b/Minecraft.Client/PSVita/Iggy/include/rrCore.h @@ -114,8 +114,8 @@ #define __RADLITTLEENDIAN__ #ifdef __i386__ #define __RADX86__ - #else - #define __RADARM__ + #else + #define __RADARM__ #endif #define RADINLINE inline #define RADRESTRICT __restrict @@ -132,7 +132,7 @@ #define __RADX86__ #else #error Unknown processor -#endif +#endif #define __RADLITTLEENDIAN__ #define RADINLINE inline #define RADRESTRICT __restrict @@ -155,7 +155,7 @@ #define __RADNACL__ #define __RAD32__ #define __RADLITTLEENDIAN__ - #define __RADX86__ + #define __RADX86__ #define RADINLINE inline #define RADRESTRICT __restrict @@ -196,7 +196,7 @@ #define __RAD64REGS__ #define __RADLITTLEENDIAN__ #define RADINLINE inline - #define RADRESTRICT __restrict + #define RADRESTRICT __restrict #undef RADSTRUCT #define RADSTRUCT struct __attribute__((__packed__)) @@ -265,7 +265,7 @@ #endif #undef RADSTRUCT #define RADSTRUCT struct __attribute__((__packed__)) - + #elif defined(CAFE) // has to be before HOLLYWOOD_REV since it also defines it #define __RADWIIU__ @@ -480,7 +480,7 @@ #undef RADRESTRICT /* could have been defined above... */ #define RADRESTRICT __restrict - + #undef RADSTRUCT #define RADSTRUCT struct __attribute__((__packed__)) #endif @@ -885,7 +885,7 @@ #define RAD_ALIGN(type,var,num) type __declspec(align(num)) var #else // NOTE: / / is a guaranteed parse error in C/C++. - #define RAD_ALIGN(type,var,num) RAD_ALIGN_USED_BUT_NOT_DEFINED / / + #define RAD_ALIGN(type,var,num) RAD_ALIGN_USED_BUT_NOT_DEFINED / / #endif // WARNING : RAD_TLS should really only be used for debug/tools stuff @@ -917,8 +917,8 @@ #define RAD_S32 signed int // But pointers are 64 bits. #if (_MSC_VER >= 1300 && defined(_Wp64) && _Wp64 ) - #define RAD_SINTa __w64 signed __int64 - #define RAD_UINTa __w64 unsigned __int64 + #define RAD_SINTa __w64 signed long long + #define RAD_UINTa __w64 unsigned long long #else // non-vc.net compiler or /Wp64 turned off #define RAD_UINTa unsigned long long #define RAD_SINTa signed long long @@ -976,8 +976,8 @@ #define RAD_U64 unsigned long long #define RAD_S64 signed long long #elif defined(__RADX64__) || defined(__RAD32__) - #define RAD_U64 unsigned __int64 - #define RAD_S64 signed __int64 + #define RAD_U64 unsigned long long + #define RAD_S64 signed long long #else // 16-bit typedef RADSTRUCT RAD_U64 // do this so that we don't accidentally use U64s @@ -1134,7 +1134,7 @@ // helpers for doing an if ( ) with expect : // if ( RAD_LIKELY(expr) ) { ... } - + #define RAD_LIKELY(expr) RAD_EXPECT(expr,1) #define RAD_UNLIKELY(expr) RAD_EXPECT(expr,0) @@ -1324,7 +1324,7 @@ __pragma(warning(push)) \ __pragma(warning(disable:4127)) \ } while(0) \ - __pragma(warning(pop)) + __pragma(warning(pop)) #define RAD_STATEMENT_END_TRUE \ __pragma(warning(push)) \ @@ -1333,10 +1333,10 @@ __pragma(warning(pop)) #else - #define RAD_USE_STANDARD_LOOP_CONSTRUCT + #define RAD_USE_STANDARD_LOOP_CONSTRUCT #endif #else - #define RAD_USE_STANDARD_LOOP_CONSTRUCT + #define RAD_USE_STANDARD_LOOP_CONSTRUCT #endif #ifdef RAD_USE_STANDARD_LOOP_CONSTRUCT @@ -1345,7 +1345,7 @@ #define RAD_STATEMENT_END_FALSE \ } while ( (void)0,0 ) - + #define RAD_STATEMENT_END_TRUE \ } while ( (void)1,1 ) @@ -1355,7 +1355,7 @@ RAD_STATEMENT_START \ code \ RAD_STATEMENT_END_FALSE - + #define RAD_INFINITE_LOOP( code ) \ RAD_STATEMENT_START \ code \ @@ -1363,7 +1363,7 @@ // Must be placed after variable declarations for code compiled as .c -#if defined(_MSC_VER) && _MSC_VER >= 1700 // in 2012 aka 11.0 and later +#if defined(_MSC_VER) && _MSC_VER >= 1700 // in 2012 aka 11.0 and later # define RR_UNUSED_VARIABLE(x) (void) x #else # define RR_UNUSED_VARIABLE(x) (void)(sizeof(x)) @@ -1473,7 +1473,7 @@ // just to make gcc shut up about derefing null : #define RR_MEMBER_OFFSET_PTR(type,member,ptr) ( (SINTa) &(((type *)(ptr))->member) - (SINTa)(ptr) ) #define RR_MEMBER_SIZE_PTR(type,member,ptr) ( sizeof( ((type *) (ptr))->member) ) - + // MEMBER_TO_OWNER takes a pointer to a member and gives you back the base of the object // you should then RR_ASSERT( &(ret->member) == ptr ); #define RR_MEMBER_TO_OWNER(type,member,ptr) (type *)( ((char *)(ptr)) - RR_MEMBER_OFFSET_PTR(type,member,ptr) ) @@ -1482,7 +1482,7 @@ // Cache / prefetch macros : // RR_PREFETCH for various platforms : -// +// // RR_PREFETCH_SEQUENTIAL : prefetch memory for reading in a sequential scan // platforms that automatically prefetch sequential (eg. PC) should be a no-op here // RR_PREFETCH_WRITE_INVALIDATE : prefetch memory for writing - contents of memory are undefined @@ -1707,7 +1707,7 @@ extern fp_rrDisplayAssertion * g_fp_rrDisplayAssertion; #define rrDisplayAssertion(i,n,l,f,m) ( ( g_fp_rrDisplayAssertion ) ? (*g_fp_rrDisplayAssertion)(i,n,l,f,m) : 1 ) //----------------------------------------------------------- - + // RAD_NO_BREAK : option if you don't like your assert to break // CB : RR_BREAK is *always* a break ; RR_ASSERT_BREAK is optional #ifdef RAD_NO_BREAK @@ -1725,7 +1725,7 @@ extern fp_rrDisplayAssertion * g_fp_rrDisplayAssertion; #define RR_ASSERT_LITE_ALWAYS(exp) RAD_STATEMENT_WRAPPER( if ( ! (exp) ) { RR_ASSERT_BREAK(); } ) //----------------------------------- -#ifdef RR_DO_ASSERTS +#ifdef RR_DO_ASSERTS #define RR_ASSERT(exp) RR_ASSERT_ALWAYS(exp) #define RR_ASSERT_LITE(exp) RR_ASSERT_LITE_ALWAYS(exp) @@ -1883,7 +1883,7 @@ unsigned long __cdecl _byteswap_ulong (unsigned long _Long); #define RR_BSWAP16 _byteswap_ushort #define RR_BSWAP32 _byteswap_ulong -unsigned __int64 __cdecl _byteswap_uint64 (unsigned __int64 val); +unsigned long long __cdecl _byteswap_uint64 (unsigned long long val); #pragma intrinsic(_byteswap_uint64) #define RR_BSWAP64 _byteswap_uint64 @@ -1909,7 +1909,7 @@ RADFORCEINLINE unsigned long RR_BSWAP32 (unsigned long _Long) return _Long; } -RADFORCEINLINE unsigned __int64 RR_BSWAP64 (unsigned __int64 _Long) +RADFORCEINLINE unsigned long long RR_BSWAP64 (unsigned long long _Long) { __asm { mov eax, DWORD PTR _Long @@ -2250,10 +2250,10 @@ void __storewordbytereverse (unsigned int val, int offset, void *bas #if ( defined(_MSC_VER) && _MSC_VER >= 1300) -unsigned __int64 __cdecl _rotl64(unsigned __int64 _Val, int _Shift); +unsigned long long __cdecl _rotl64(unsigned long long _Val, int _Shift); #pragma intrinsic(_rotl64) -#define RR_ROTL64(x,k) _rotl64((unsigned __int64)(x),(int)(k)) +#define RR_ROTL64(x,k) _rotl64((unsigned long long)(x),(int)(k)) #elif defined(__RADCELL__) @@ -2262,7 +2262,7 @@ unsigned __int64 __cdecl _rotl64(unsigned __int64 _Val, int _Shift); #elif defined(__RADLINUX__) || defined(__RADMACAPI__) -//APTODO: Just to compile linux. Should we be doing better than this? If not, combine with above. +//APTODO: Just to compile linux. Should we be doing better than this? If not, combine with above. #define RR_ROTL64(u64,num) ( ( (u64) << (num) ) | ( (u64) >> (64 - (num))) ) #else diff --git a/Minecraft.Client/PSVita/Miles/include/mss.h b/Minecraft.Client/PSVita/Miles/include/mss.h index 531dcbc9..754f536b 100644 --- a/Minecraft.Client/PSVita/Miles/include/mss.h +++ b/Minecraft.Client/PSVita/Miles/include/mss.h @@ -39,7 +39,7 @@ // doc system stuff #ifndef EXPAPI -#define EXPAPI +#define EXPAPI #endif #ifndef EXPTYPE #define EXPTYPE @@ -69,10 +69,10 @@ // For docs EXPGROUP(_NullGroup) #define MilesVersion "9.3m" EXPMACRO -#define MilesMajorVersion 9 EXPMACRO +#define MilesMajorVersion 9 EXPMACRO #define MilesMinorVersion 3 EXPMACRO -#define MilesBuildNumber 11 EXPMACRO -#define MilesCustomization 0 EXPMACRO +#define MilesBuildNumber 11 EXPMACRO +#define MilesCustomization 0 EXPMACRO EXPGROUP(_RootGroup) @@ -273,14 +273,14 @@ typedef void VOIDFUNC(void); //================ EXPGROUP(Basic Types) -#define AILCALL EXPTAG(AILCALL) +#define AILCALL EXPTAG(AILCALL) /* Internal calling convention that all external Miles functions use. Usually cdecl or stdcall on Windows. */ -#define AILCALLBACK EXPTAG(AILCALLBACK docproto) +#define AILCALLBACK EXPTAG(AILCALLBACK docproto) /* Calling convention that user supplied callbacks <b>from</b> Miles use. @@ -326,7 +326,7 @@ RADDEFSTART typedef CHAR *LPSTR, *PSTR; #ifdef IS_WIN64 - typedef unsigned __int64 ULONG_PTR, *PULONG_PTR; + typedef uint64_t ULONG_PTR, *PULONG_PTR; #else #ifdef _Wp64 #if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300 @@ -348,13 +348,13 @@ RADDEFSTART typedef struct HWAVEOUT__ *HWAVEOUT; typedef HWAVEIN *LPHWAVEIN; typedef HWAVEOUT *LPHWAVEOUT; - + #ifndef WAVE_MAPPER #define WAVE_MAPPER ((UINT)-1) #endif typedef struct waveformat_tag *LPWAVEFORMAT; - + typedef struct HMIDIOUT__ *HMIDIOUT; typedef HMIDIOUT *LPHMIDIOUT; typedef struct HWND__ *HWND; @@ -368,9 +368,9 @@ RADDEFSTART // If compiling MSS DLL, use __declspec(dllexport) for both // declarations and definitions // - + #ifdef IS_WIN32 - + #if !defined(FORNONWIN) && !defined(__RADNTBUILDLINUX__) #define AILLIBCALLBACK __stdcall #define AILCALL __stdcall @@ -382,20 +382,20 @@ RADDEFSTART #define AILCALLBACK __cdecl #define AILEXPORT __cdecl #endif - + #ifdef __RADINDLL__ #define DXDEC __declspec(dllexport) #define DXDEF __declspec(dllexport) #else - + #if defined( __BORLANDC__ ) || defined( MSS_SPU_PROCESS ) #define DXDEC extern #else #define DXDEC __declspec(dllimport) #endif - + #endif - + #ifdef IS_WIN64 #define MSSDLLNAME "MSS64.DLL" #define MSS_REDIST_DIR_NAME "redist64" @@ -403,11 +403,11 @@ RADDEFSTART #define MSSDLLNAME "MSS32.DLL" #define MSS_REDIST_DIR_NAME "redist" #endif - + #define MSS_DIR_SEP "\\" #define MSS_DIR_UP ".." MSS_DIR_SEP #define MSS_DIR_UP_TWO MSS_DIR_UP MSS_DIR_UP - + #endif typedef void * LPVOID; @@ -420,7 +420,7 @@ RADDEFSTART #define AILLIBCALLBACK #define AILCALL #define AILEXPORT - #define AILCALLBACK + #define AILCALLBACK #elif defined(__RADX86__) #define AILLIBCALLBACK __attribute__((cdecl)) #define AILCALL __attribute__((cdecl)) @@ -437,7 +437,7 @@ RADDEFSTART #define DXDEC extern #define DXDEF #endif - + #ifdef __RADX64__ #define MSS_REDIST_DIR_NAME "redist/x64" #elif defined(IS_X86) @@ -447,7 +447,7 @@ RADDEFSTART #else #error "No Redist Dir Specified" #endif - + #define MSS_DIR_SEP "/" #define MSS_DIR_UP ".." MSS_DIR_SEP #define MSS_DIR_UP_TWO MSS_DIR_UP MSS_DIR_UP @@ -714,7 +714,7 @@ typedef enum #ifndef FILE_ERRS #define FILE_ERRS - + #define AIL_NO_ERROR 0 #define AIL_IO_ERROR 1 #define AIL_OUT_OF_MEMORY 2 @@ -736,9 +736,9 @@ EXPTYPEBEGIN typedef SINTa HMSSENUM; EXPTYPEEND /* specifies a type used to enumerate through a list of properties. - + $:MSS_FIRST use this value to start the enumeration process. - + The Miles enumeration functions all work similarly - you set a local variable of type HMSSENUM to MSS_FIRST and then call the enumeration function until it returns 0. @@ -751,7 +751,7 @@ the enumeration function until it returns 0. // Preference names and default values // -#define AIL_MM_PERIOD 0 +#define AIL_MM_PERIOD 0 #define DEFAULT_AMP 1 // Default MM timer period = 5 msec. #define AIL_TIMERS 1 @@ -1877,7 +1877,7 @@ typedef struct _S3DSTATE // Portion of HSAMPLE that deals with 3D posi F32 lowpass_3D; // low pass cutoff computed by falloff graph. -1 if not affected. F32 spread; - + HSAMPLE owner; // May be NULL if used for temporary/internal calculations AILFALLOFFCB falloff_function; // User function for min/max distance calculations, if desired @@ -1915,7 +1915,7 @@ typedef struct _SAMPLE // Sample instance S32 index; // Numeric index of this sample SMPBUF buf[8]; // Source data buffers - + U32 src_fract; // Fractional part of source address U32 mix_delay; // ms until start mixing (decreased every buffer mix) @@ -1924,7 +1924,7 @@ typedef struct _SAMPLE // Sample instance U64 mix_bytes; // total number of bytes sent to the mixer for this sample. S32 group_id; // ID for grouped operations. - + // size of the next dynamic arrays U32 chan_buf_alloced; U32 chan_buf_used; @@ -1946,10 +1946,10 @@ typedef struct _SAMPLE // Sample instance // these are dynamic arrays F32 *auto_3D_channel_levels; // Channel levels set by 3D positioner (always 1.0 if not 3D-positioned) F32 *speaker_levels; // one level per speaker (multiplied after user or 3D) - + S8 *speaker_enum_to_source_chan; // array[MSS_SPEAKER_xx] = -1 if not present, else channel # // 99% of the time this is a 1:1 mapping and is zero. - + S32 lp_any_on; // are any of the low pass filters on? S32 user_channels_need_deinterlace; // do any of the user channels require a stereo sample to be deinterlaced? @@ -1989,7 +1989,7 @@ typedef struct _SAMPLE // Sample instance U32 low_pass_changed; // bit mask for what channels changed. - + S32 bus; // Bus assignment for this sample. S32 bus_comp_sends; // Which buses this bus routes compressor input to. S32 bus_comp_installed; // Nonzero if we have a compressor installed. @@ -2042,7 +2042,7 @@ typedef struct _SAMPLE // Sample instance SPINFO pipeline[N_SAMPLE_STAGES]; S32 n_active_filters; // # of SP_FILTER_n stages active - + // // 3D-related state for all platforms (including Xbox) // @@ -2113,14 +2113,14 @@ DXDEC void AILCALL AIL_serve(void); #ifdef IS_MAC typedef void * LPSTR; - + #define WHDR_DONE 0 - + typedef struct _WAVEIN { long temp; } * HWAVEIN; - + typedef struct _WAVEHDR { S32 dwFlags; @@ -2133,7 +2133,7 @@ DXDEC void AILCALL AIL_serve(void); S32 dwLoops; void * lpNext; U32 * reserved; - + } WAVEHDR, * LPWAVEHDR; #endif @@ -2145,7 +2145,7 @@ typedef struct _DIG_INPUT_DRIVER *HDIGINPUT; // Handle to digital input driver #ifdef IS_MAC #define AIL_DIGITAL_INPUT_DEFAULT 0 - + typedef struct _DIG_INPUT_DRIVER // Handle to digital input driver { U32 tag; // HDIN @@ -2478,7 +2478,7 @@ typedef struct _DIG_DRIVER // Handle to digital audio driver U32 last_ds_play; U32 last_ds_write; U32 last_ds_move; - + #endif #ifdef IS_X86 @@ -2661,7 +2661,7 @@ typedef struct _SEQUENCE // XMIDI sequence state table void const *EVNT; U8 const *EVNT_ptr; // Current event pointer - + U8 *ICA; // Indirect Controller Array AILPREFIXCB prefix_callback; // XMIDI Callback Prefix handler @@ -3121,13 +3121,13 @@ DXDEC S32 AILCALL AIL_timer_thread_handle(void* o_handle); #elif defined(__RADANDROID__) DXDEC void AILCALL AIL_set_asset_manager(void* asset_manager); - + DXDEC RADSS_OPEN_FUNC AILCALL RADSS_SLESInstallDriver(UINTa, UINTa); #define AIL_open_digital_driver(frequency, bits, channel, flags) \ AIL_open_generic_digital_driver(frequency, bits, channel, flags, RADSS_SLESInstallDriver(0, 0)) - + #elif defined(IS_PSP2) DXDEC RADSS_OPEN_FUNC AILCALL RADSS_PSP2InstallDriver(UINTa, UINTa); @@ -3221,7 +3221,7 @@ DXDEC S32 AILCALL AIL_digital_handle_reacquire { Str255 version_name; } MSS_VersionType; - + #define AIL_MSS_version(str,len) \ { \ long _res = HOpenResFile(0,0,"\p" MSSDLLNAME,fsRdPerm); \ @@ -3269,11 +3269,11 @@ DXDEC S32 AILCALL AIL_digital_handle_reacquire } \ } \ } - + #endif DXDEC S32 AILCALL AIL_digital_handle_release(HDIGDRIVER drvr); - + DXDEC S32 AILCALL AIL_digital_handle_reacquire (HDIGDRIVER drvr); @@ -3339,18 +3339,18 @@ DXDEC EXPAPI void AILCALL AIL_push_system_state(HDIGDRIVER dig, U32 flags, S16 c $* <b>MILES_PUSH_VOLUME</b> - When present, master volume will be affected in addition to sample state. If MILES_PUSH_RESET is present, the master volume will be set to 1.0f, otherwise it will be retained and only - affected when popped. + affected when popped. $- - If you want more control over whether a sample will be affected by a push or a pop operation, + If you want more control over whether a sample will be affected by a push or a pop operation, see $AIL_set_sample_level_mask. - + */ DXDEC EXPAPI void AILCALL AIL_pop_system_state(HDIGDRIVER dig, S16 crossfade_ms); /* - Pops the current system state and returns the system to the way it + Pops the current system state and returns the system to the way it was before the last push. $:dig The driver to pop. @@ -3374,7 +3374,7 @@ DXDEC EXPAPI void AILCALL AIL_set_sample_level_mask(HSAMPLE S, U8 mask); $:S The sample to set the mask for. $:mask The bitmask of levels for which the sample will play. - Under normal push/pop operations, a sample's mask is set when it is + Under normal push/pop operations, a sample's mask is set when it is started to the level the system is at. If the system is pushed without a reset, then the mask is adjusted to include the new level. When a system is popped, if the sample is going to continue playing, @@ -3435,7 +3435,7 @@ DXDEC EXPAPI HSAMPLE AILCALL AIL_allocate_bus(HDIGDRIVER dig); $:return The HSAMPLE for the new bus. A bus allows you to treat a group of samples as one sample. With the bus sample you can - do almost all of the things you can do with a normal sample handle. The only exception + do almost all of the things you can do with a normal sample handle. The only exception is you can't adjust the playback rate of the sample. Use $AIL_bus_sample_handle to get the HSAMPLE associated with a bus. @@ -3495,7 +3495,7 @@ DXDEC EXPAPI S32 AILCALL AIL_sample_bus(HSAMPLE S); DXDEC EXPAPI S32 AILCALL AIL_install_bus_compressor(HDIGDRIVER dig, S32 bus_index, SAMPLESTAGE filter_stage, S32 input_bus_index); /* - Installs the Compressor filter on to a bus, using another bus as the input for + Installs the Compressor filter on to a bus, using another bus as the input for compression/limiting. $:dig The driver the busses exist on. @@ -3508,7 +3508,7 @@ DXDEC EXPAPI S32 AILCALL AIL_install_bus_compressor(HDIGDRIVER dig, S32 bus_inde its signal strength to the filter, allowing it to attenuate the bus_index bus based on another bus's contents. - To control the compressor parameters, access the bus's HSAMPLE via $AIL_bus_sample_handle and + To control the compressor parameters, access the bus's HSAMPLE via $AIL_bus_sample_handle and use $AIL_sample_stage_property exactly as you would any other filter. The filter's properties are documented under $(Compressor Filter) */ @@ -4325,7 +4325,7 @@ typedef void (AILCALLBACK* AILSTREAMCB) (HSTREAM stream); #define MSS_STREAM_CHUNKS 8 -typedef struct _STREAM +typedef struct _STREAM { S32 block_oriented; // 1 if this is an ADPCM or ASI-compressed stream S32 using_ASI; // 1 if using ASI decoder to uncompress stream data @@ -4349,7 +4349,7 @@ typedef struct _STREAM S32 read_IO_index; // index of buffer to be loaded into Miles next S32 bufsize; // size of each buffer - + U32 datarate; // datarate in bytes per second S32 filerate; // original datarate of the file S32 filetype; // file format type @@ -4987,7 +4987,7 @@ typedef struct OGG_INFO; DXDEC void AILCALL AIL_inspect_Ogg (OGG_INFO *inspection_state, - U8 *Ogg_file_image, + U8 *Ogg_file_image, S32 Ogg_file_size); DXDEC S32 AILCALL AIL_enumerate_Ogg_pages (OGG_INFO *inspection_state); @@ -5102,10 +5102,10 @@ DXDEC HDIGDRIVER AILCALL AIL_primary_digital_driver (HDIGDRIVER new_primary); // 3D-related calls // -DXDEC S32 AILCALL AIL_room_type (HDIGDRIVER dig, +DXDEC S32 AILCALL AIL_room_type (HDIGDRIVER dig, S32 bus_index); -DXDEC void AILCALL AIL_set_room_type (HDIGDRIVER dig, +DXDEC void AILCALL AIL_set_room_type (HDIGDRIVER dig, S32 bus_index, S32 room_type); @@ -5180,7 +5180,7 @@ DXDEC EXPAPI void AILCALL AIL_set_sample_3D_lowpass_falloff(HSAMPLE S, MSS $:graph The array of points to use as the graph. $:pointcount The number of points passed in. Must be less than or equal to MILES_MAX_FALLOFF_GRAPH_POINTS. Passing 0 removes the graph. - This marks a sample as having a low pass cutoff that varies as a function of distance to the listener. If + This marks a sample as having a low pass cutoff that varies as a function of distance to the listener. If a sample has such a graph, $AIL_set_sample_low_pass_cut_off will be called constantly, and thus shouldn't be called otherwise. @@ -5195,8 +5195,8 @@ DXDEC EXPAPI void AILCALL AIL_set_sample_3D_exclusion_falloff(HSAMPLE S, M $:graph The array of points to use as the graph. $:pointcount The number of points passed in. Must be less than or equal to MILES_MAX_FALLOFF_GRAPH_POINTS. Passing 0 removes the graph. - This marks a sample as having an exclusion that varies as a function of distance to the listener. If - a sample has such a graph, auto_3D_wet_atten will be disabled to prevent double affects, as exclusion + This marks a sample as having an exclusion that varies as a function of distance to the listener. If + a sample has such a graph, auto_3D_wet_atten will be disabled to prevent double affects, as exclusion affects reverb wet level. The graph is evaluated the same as $AIL_set_sample_3D_volume_falloff. @@ -5230,7 +5230,7 @@ DXDEC EXPAPI void AILCALL AIL_set_sample_3D_position_segments(HSAMPLE S, MSSVECT other computations (cones, falloffs, etc). Spatialization is done using all segments as a directional source. - If there is neither spread falloff nor volume falloff specified, spread will be automatically applied + If there is neither spread falloff nor volume falloff specified, spread will be automatically applied when the listener is within min_distance to the closest point. See $AIL_set_sample_3D_spread_falloff and $AIL_set_sample_3D_volume_falloff. @@ -5243,7 +5243,7 @@ DXDEC EXPAPI void AILCALL AIL_set_sample_3D_spread(HSAMPLE S, F32 spread); $:S Sample to affect. $:spread The value to set the spread to. - Spread is how much the directionality of a sample "spreads" to more speakers - emulating + Spread is how much the directionality of a sample "spreads" to more speakers - emulating the effect a sound has when it occupies more than a point source. For instance, a sound point source that sits directly to the left of the listener would have a very strong left speaker signal, and a fairly weak right speaker signal. Via spread, the signal would be @@ -5392,7 +5392,7 @@ EXPGROUP(Miles High Level Event System) EXPTYPE typedef struct MSSSOUNDBANK {}; /* Internal structure. - + Use $HMSOUNDBANK instead. */ @@ -5401,7 +5401,7 @@ EXPTYPE typedef struct MSSSOUNDBANK {}; EXPTYPE typedef struct SoundBank *HMSOUNDBANK; /* Describes a handle to an open sound bank. - + This handle typedef refers to an open soundbank which is usually obtained from the $AIL_add_soundbank function. */ @@ -5424,7 +5424,7 @@ DXDEC EXPAPI void AILCALL AIL_close_soundbank(HMSOUNDBANK bank); Close a soundbank previously opened with $AIL_open_soundbank. $:bank Soundbank to close. - + Close a soundbank previously opened with $AIL_open_soundbank. Presets/events loaded from this soundbank are no longer valid. */ @@ -5448,7 +5448,7 @@ DXDEC EXPAPI char const * AILCALL AIL_get_soundbank_name(HMSOUNDBANK bank); $:return A pointer to the name of the sound bank, or 0 if the bank is invalid. - The name of the bank is the name used in asset names. This is distinct from the + The name of the bank is the name used in asset names. This is distinct from the file name of the bank. The return value should not be deleted. @@ -5457,7 +5457,7 @@ DXDEC EXPAPI char const * AILCALL AIL_get_soundbank_name(HMSOUNDBANK bank); DXDEC EXPAPI S32 AILCALL AIL_get_soundbank_mem_usage(HMSOUNDBANK bank); /* Returns the amount of data used by the soundbank management structures. - + $:bank Soundbank to query. $:return Total memory allocated. @@ -5476,7 +5476,7 @@ DXDEC EXPAPI S32 AILCALL AIL_enumerate_sound_presets(HMSOUNDBANK bank, HMSSENUM* $:return Returns 0 when enumeration is complete. Enumerates the sound presets available inside of a bank file. Example usage: - + ${ HMSSENUM Token = MSS_FIRST; const char* PresetName = 0; @@ -5503,7 +5503,7 @@ DXDEC EXPAPI S32 AILCALL AIL_enumerate_environment_presets(HMSOUNDBANK bank, HMS $:return Returns 0 when enumeration is complete. Enumerates the environment presets available inside of a bank file. Example usage: - + ${ HMSSENUM Token = MSS_FIRST; const char* PresetName = 0; @@ -5530,7 +5530,7 @@ DXDEC EXPAPI S32 AILCALL AIL_enumerate_sound_assets(HMSOUNDBANK bank, HMSSENUM* $:return Returns 0 when enumeration is complete. Enumerates the sounds available inside of a bank file. Example usage: - + ${ HMSSENUM Token = MSS_FIRST; const char* SoundName = 0; @@ -5549,7 +5549,7 @@ DXDEC EXPAPI S32 AILCALL AIL_enumerate_sound_assets(HMSOUNDBANK bank, HMSSENUM* Note that name should NOT be deleted by the caller - this points at memory owned by Miles. */ - + DXDEC EXPAPI S32 AILCALL AIL_enumerate_events(HMSOUNDBANK bank, HMSSENUM* next, char const * list, char const ** name); /* Enumerate the events stored in a soundbank. @@ -5561,7 +5561,7 @@ DXDEC EXPAPI S32 AILCALL AIL_enumerate_events(HMSOUNDBANK bank, HMSSENUM* next, $:return Returns 0 when enumeration is complete. Enumerates the events available inside of a bank file. Example usage: - + ${ HMSSENUM Token = MSS_FIRST; const char* EventName = 0; @@ -5624,7 +5624,7 @@ DXDEC EXPAPI S32 AILCALL AIL_apply_sound_preset(HSAMPLE sample, HMSOUNDBANK bank $:return Returns 0 on fail - check for sample/bank validity, and that the preset is in the correct bank. This will alter the properties on a given sample, based on the given preset. -*/ +*/ DXDEC EXPAPI S32 AILCALL AIL_unapply_raw_sound_preset(HSAMPLE sample, void* preset); /* @@ -5644,7 +5644,7 @@ DXDEC EXPAPI S32 AILCALL AIL_unapply_sound_preset(HSAMPLE sample, HMSOUNDBANK ba $:return Returns 0 on fail - check for sample/bank validity, and that the preset is in the correct bank. Presets may or may not affect any given property. Only the properties affected by the specified - preset will have their values restored to default. + preset will have their values restored to default. */ typedef S32 (*MilesResolveFunc)(void* context, char const* exp, S32 explen, EXPOUT void* output, S32 isfloat); @@ -5658,7 +5658,7 @@ typedef S32 (*MilesResolveFunc)(void* context, char const* exp, S32 explen, EXPO $:isfloat nonzero if the output needs to be a float. The function callback should convert variable expressions in to an output value of the - requested type. + requested type. */ DXDEC EXPAPI S32 AILCALL AIL_resolve_raw_sound_preset(void* preset, void* context, MilesResolveFunc eval); @@ -5777,7 +5777,7 @@ DXDEC EXPAPI S32 AILCALL AIL_sound_asset_info(HMSOUNDBANK bank, char const* name $:name The name of the sound asset to find. $:out_name Optional - Pointer to a buffer that is filled with the sound filename to use for loading. $:out_info Pointer to a $MILESBANKSOUNDINFO structure that is filled with meta data about the sound asset. - $:return Returns the byte size of the buffer required for out_name. + $:return Returns the byte size of the buffer required for out_name. This function must be called in order to resolve the sound asset name to something that can be used by miles. To ensure safe buffer containment, call @@ -5832,7 +5832,7 @@ typedef struct _MEMDUMP* HMEMDUMP; ReturnType = "HMSSEVENTCONSTRUCT", "An empty event to be passed to the various step addition functions, or 0 if out of memory." - Discussion = "Primarily designed for offline use, this function is the first step in + Discussion = "Primarily designed for offline use, this function is the first step in creating an event that can be consumed by the MilesEvent system. Usage is as follows: HMSSEVENTCONSTRUCT hEvent = AIL_create_event(); @@ -5850,7 +5850,7 @@ typedef struct _MEMDUMP* HMEMDUMP; Note that if immediately passed to AIL_enqueue_event(), the memory must remain valid until the following $AIL_complete_event_queue_processing. - + Events are generally tailored to the MilesEvent system, even though there is nothing preventing you from writing your own event system, or creation ui. " @@ -5906,7 +5906,7 @@ EXPTYPEEND /* Determines the usage of the sound names list in the $AIL_add_start_sound_event_step. - $:MILES_START_STEP_RANDOM Randomly select from the list, and allow the same + $:MILES_START_STEP_RANDOM Randomly select from the list, and allow the same sound to play twice in a row. This is the only selection type that doesn't require a state variable. $:MILES_START_STEP_NO_REPEATS Randomly select from the list, but prevent the last sound from being the same. @@ -5926,10 +5926,10 @@ EXPTYPEEND Name = "AIL_add_start_sound_event_step", "Adds a step to a given event to start a sound with the given specifications." In = "HMSSEVENTCONSTRUCT", "i_Event", "The event to add the step to." - In = "const char*", "i_SoundNames", "The names and associated weights for the event step to choose from. - If there are multiple names listed, the sound will be chosen at random based on the given weights. This + In = "const char*", "i_SoundNames", "The names and associated weights for the event step to choose from. + If there are multiple names listed, the sound will be chosen at random based on the given weights. This string is of the form 'BankName1/SoundName1:Weight1:BankName2/SoundName2:Weight2:' etc. The string must always - terminate in a ':'. Weight must be between 0 and 200. To provide a null sound to randomly choose to not play anything, use + terminate in a ':'. Weight must be between 0 and 200. To provide a null sound to randomly choose to not play anything, use an empty string as an entry." In = "const char*", "i_PresetName", "[optional] The name of the preset, of the form 'PresetList/PresetName'" @@ -5944,7 +5944,7 @@ EXPTYPEEND In = "U8", "i_CanLoad", "If nonzero, the sound is allowed to hit the disk instead of only accessing cached sounds. If true, this might cause a hitch." In = "U16", "i_Delay", "The minimum delay in ms to apply to the sound before start." In = "U16", "i_DelayMax", "The maximum delay in ms to apply to the sound before start." - In = "U8", "i_Priority", "The priority to assign to the sound. If a sound encounters a limit based on its labels, it will evict any sound + In = "U8", "i_Priority", "The priority to assign to the sound. If a sound encounters a limit based on its labels, it will evict any sound with a priority strictly less than the given priority." In = "U8", "i_LoopCount", "The loop count as per AIL_set_sample_loop_count." In = "const char*", "i_StartOffset", "[optional] The name of the marker to use as the sound's initial offset." @@ -5969,19 +5969,19 @@ DXDEC S32 AILCALL AIL_add_start_sound_event_step( - HMSSEVENTCONSTRUCT i_Event, + HMSSEVENTCONSTRUCT i_Event, const char* i_SoundNames, - const char* i_PresetName, + const char* i_PresetName, U8 i_PresetIsDynamic, const char* i_EventName, const char* i_StartMarker, const char* i_EndMarker, char const* i_StateVar, char const* i_VarInit, - const char* i_Labels, U32 i_Streaming, U8 i_CanLoad, + const char* i_Labels, U32 i_Streaming, U8 i_CanLoad, U16 i_Delay, U16 i_DelayMax, U8 i_Priority, U8 i_LoopCount, const char* i_StartOffset, F32 i_VolMin, F32 i_VolMax, F32 i_PitchMin, F32 i_PitchMax, F32 i_FadeInTime, - U8 i_EvictionType, + U8 i_EvictionType, U8 i_SelectType ); @@ -6004,7 +6004,7 @@ AIL_add_start_sound_event_step( In order to release the data loaded by this event, AIL_add_uncache_sounds_event_step() needs to be called with the same parameters. - + If you are using MilesEvent, the data is refcounted so the sound will not be freed until all samples using it complete." } @@ -6089,7 +6089,7 @@ DXDEC S32 AILCALL AIL_add_control_sounds_event_step( - HMSSEVENTCONSTRUCT i_Event, + HMSSEVENTCONSTRUCT i_Event, const char* i_Labels, const char* i_MarkerStart, const char* i_MarkerEnd, const char* i_Position, const char* i_PresetName, U8 i_PresetApplyType, @@ -6191,7 +6191,7 @@ DXDEC EXPAPI S32 AILCALL AIL_add_setblend_event_step(HMSSEVENTCONSTRUCT i_Event, Defines a named blend function to be referenced by a blended sound later. $:i_Event The event to add the step to. - $:i_Name The name of the blend. This is the name that will be + $:i_Name The name of the blend. This is the name that will be referenced by the state variable in start sound, as well as the variable name to set by the game to update the blend for an instance. $:i_SoundCount The number of sounds this blend will affect. Max 10. @@ -6226,7 +6226,7 @@ DXDEC EXPAPI S32 AILCALL AIL_add_setblend_event_step(HMSSEVENTCONSTRUCT i_Event, Miles max sample count." } */ -DXDEC S32 AILCALL +DXDEC S32 AILCALL AIL_add_sound_limit_event_step(HMSSEVENTCONSTRUCT i_Event, char const* i_LimitName, const char* i_SoundLimits); /*! @@ -6257,8 +6257,8 @@ AIL_add_sound_limit_event_step(HMSSEVENTCONSTRUCT i_Event, char const* i_LimitNa AIL_add_persist_preset_event_step(hEvent, 0, `"Underwater`", 0);" } */ -DXDEC S32 AILCALL -AIL_add_persist_preset_event_step(HMSSEVENTCONSTRUCT i_Event, const char* i_PresetName, const char* i_PersistName, +DXDEC S32 AILCALL +AIL_add_persist_preset_event_step(HMSSEVENTCONSTRUCT i_Event, const char* i_PresetName, const char* i_PersistName, const char* i_Labels, U8 i_IsDynamic ); @@ -6272,13 +6272,13 @@ DXDEC EXPAPI S32 AILCALL AIL_get_event_contents(HMSOUNDBANK bank, char const * n thus shouldn't be checked via strlen, etc. $:return Returns 0 on fail. - Normally, event contents are meant to be handled by the Miles high-level system via $AIL_enqueue_event, + Normally, event contents are meant to be handled by the Miles high-level system via $AIL_enqueue_event, rather than inspected directly. */ DXDEC EXPAPI S32 AILCALL AIL_add_clear_state_event_step(HMSSEVENTCONSTRUCT i_Event); /* - Clears all persistent state in the runtime. + Clears all persistent state in the runtime. $:i_Event The event to add the step to. @@ -6311,7 +6311,7 @@ DXDEC EXPAPI S32 AILCALL AIL_add_enable_limit_event_step(HMSSEVENTCONSTRUCT i_Ev DXDEC EXPAPI S32 AILCALL AIL_add_set_lfo_event_step(HMSSEVENTCONSTRUCT i_Event, char const* i_Name, char const* i_Base, char const* i_Amp, char const* i_Freq, S32 i_Invert, S32 i_Polarity, S32 i_Waveform, S32 i_DutyCycle, S32 i_IsLFO); /* Adds a step to define a variable that oscillates over time. - + $:i_Event The event to add the step to. $:i_Name The nane of the variable to oscillate. $:i_Base The value to oscillate around, or a variable name to use as the base. @@ -6327,15 +6327,15 @@ DXDEC EXPAPI S32 AILCALL AIL_add_set_lfo_event_step(HMSSEVENTCONSTRUCT i_Event, DXDEC EXPAPI S32 AILCALL AIL_add_move_var_event_step(HMSSEVENTCONSTRUCT i_Event, char const* i_Name, const F32 i_Times[2], const S32 i_InterpolationTypes[2], const F32 i_Values[3]); /* Adds a step to set and move a variable over time on a curve. - + $:i_Event The event to add the step to. $:i_Name The variable to move. $:i_Times The midpoint and final times for the curves $:i_InterpolationTypes The curve type for the two curves - Curve In (0), Curve Out (1), S-Curve (2), Linear (3) $:i_Values The initial, midpoint, and final values for the variable. - + The variable is locked to this curve over the timeperiod - no interpolation from a previous value is done. - + If an existing move var exists when the new one is added, the old one is replaced. */ @@ -6450,7 +6450,7 @@ struct EVENT_STEP_INFO U8 isdynamic; } persist; - struct + struct { MSSSTRINGC name; MSSSTRINGC labels; @@ -6522,7 +6522,7 @@ struct EVENT_STEP_INFO the string location of the next event step in the buffer." Discussion = "This function parses the event string in to a struct for usage by the user. This function should only be - used by the MilesEvent system. It returns the pointer to the next step to be passed to this function to get the + used by the MilesEvent system. It returns the pointer to the next step to be passed to this function to get the next step. In this manner it can be used in a loop: // Create an event to stop all sounds. @@ -6610,11 +6610,11 @@ EXPTYPE typedef void* HEVENTSYSTEM; DXDEC EXPAPI HEVENTSYSTEM AILCALL AIL_startup_event_system(HDIGDRIVER dig, S32 command_buf_len, EXPOUT char* memory_buf, S32 memory_len); /* Initializes the Miles Event system and associates it with an open digital driver. - + $:dig The digital sound driver that this event system should use. $:command_buf_len An optional number of bytes to use for the command buffer. If you pass 0, a reasonable default will be used (currently 5K). - $:memory_buf An optional pointer to a memory buffer buffer that the event system will use for all event allocations. - Note that the sound data itself is not stored in this buffer - it is only for internal buffers, the command buffer, and instance data. + $:memory_buf An optional pointer to a memory buffer buffer that the event system will use for all event allocations. + Note that the sound data itself is not stored in this buffer - it is only for internal buffers, the command buffer, and instance data. Use 0 to let Miles to allocate this buffer itself. $:memory_len If memory_buf is non-null, then this parameter provides the length. If memory_buf is null, the Miles will allocate this much memory for internal buffers. If both memory_buf and memory_len are null, the Miles will allocate reasonable default (currently 64K). @@ -6633,8 +6633,8 @@ DXDEC EXPAPI HEVENTSYSTEM AILCALL AIL_add_event_system(HDIGDRIVER dig); $:return A handle to the event system to use in various high level functions. Both systems will access the same set of loaded soundbanks, and are updated when $AIL_begin_event_queue_processing is called. - - To enqueue events to the new system, use $AIL_enqueue_event_system. + + To enqueue events to the new system, use $AIL_enqueue_event_system. To iterate the sounds for the new system, pass the $HEVENTSYSTEM as the first parameter to $AIL_enumerate_sound_instances. @@ -6646,7 +6646,7 @@ DXDEC EXPAPI HEVENTSYSTEM AILCALL AIL_add_event_system(HDIGDRIVER dig); DXDEC EXPAPI void AILCALL AIL_shutdown_event_system( void ); /* Shuts down the Miles event system. - + This function will closes everything in the event system - it ignores reference counts. It will free all event memory, sound banks, and samples used by the system. */ @@ -6660,10 +6660,10 @@ DXDEC EXPAPI HMSOUNDBANK AILCALL AIL_add_soundbank(char const * filename, char c $:return The handle to the newly loaded soundbank (zero on failure). This function opens the sound bank and makes it available to the event system. The filename - is the name on the media, and the name is the symbolic name you used in the Miles Sound Studio. + is the name on the media, and the name is the symbolic name you used in the Miles Sound Studio. You might, for example, be using a soundbank with a platform extension, like: 'gamebank_ps3.msscmp', and while using the name 'gamebank' for authoring and auditioning. - + Sound data is not loaded when this function is called - it is only loaded when the relevant Cache Sounds is played, or a sound requiring it plays. @@ -6685,7 +6685,7 @@ DXDEC EXPAPI S32 AILCALL AIL_release_soundbank(HMSOUNDBANK bank); Any other data references still existing (queued events, persisted presets, etc) will report errors when used, but will not crash. - + Releasing a sound bank does not free any cached sounds loaded from the bank - any sounds from the bank should be freed via a Purge Sounds event step. If this does not occur, the sound data will still be loaded, but the sound metadata will be gone, so Start Sound events will not work. Purge Sounds will still work. @@ -6698,24 +6698,24 @@ DXDEC U8 const * AILCALL AIL_find_event(HMSOUNDBANK bank,char const* event_name) (EXPAPI removed to prevent release in docs) Searches for an event by name in the event system. - + $:bank The soundbank to search within, or 0 to search all open banks (which is the normal case). $:event_name The name of the event to find. This name should be of the form "soundbank/event_list/event_name". $:return A pointer to the event contents (or 0, if the event isn't found). - + This function is normally used as the event parameter for $AIL_enqueue_event. It searches one or all open soundbanks for a particular event name. - - <b>This is deprecated</b>. If you know the event name, you should use $AIL_enqueue_event_by_name, or $AIL_enqueue_event with + + <b>This is deprecated</b>. If you know the event name, you should use $AIL_enqueue_event_by_name, or $AIL_enqueue_event with MILESEVENT_ENQUEUE_BY_NAME. - + Events that are not enqueued by name can not be tracked by the Auditioner. */ DXDEC EXPAPI U64 AILCALL AIL_enqueue_event_system(HEVENTSYSTEM system, U8 const * event, void* user_buffer, S32 user_buffer_len, S32 enqueue_flags, U64 apply_to_ID ); /* Enqueue an event to a specific system. Used only if you have multiple event systems running. - + $:system The event system to attach the event to. $:return See $AIL_enqueue_event for return description. @@ -6728,10 +6728,10 @@ DXDEC EXPAPI U64 AILCALL AIL_enqueue_event_by_name(char const* name); $:name The full name of the event, eg "soundbank/path/to/event". $:return See $AIL_enqueue_event for return description. - - This is the most basic way to enqueue an event. It enqueues an event by name, and as a result the event will be tracked by the auditioner. - - For when you need more control over the event, but still want it to be tracked by the auditioner, it is equivalent + + This is the most basic way to enqueue an event. It enqueues an event by name, and as a result the event will be tracked by the auditioner. + + For when you need more control over the event, but still want it to be tracked by the auditioner, it is equivalent to calling $AIL_enqueue_event_end_named($AIL_enqueue_event_start(), name) For introduction to the auditioning system, see $integrating_events. @@ -6743,9 +6743,9 @@ DXDEC EXPAPI S32 AILCALL AIL_enqueue_event_start(); $:return A token used for passing to functions that add data to the event. - This is used to pass more data to an event that will be executed. For instance, if + This is used to pass more data to an event that will be executed. For instance, if an event is going to spatialize a sound, but there's no need to move the sound over the course of - its lifetime, you can add positional data to the event via $AIL_enqueue_event_position. When a + its lifetime, you can add positional data to the event via $AIL_enqueue_event_position. When a sound is started it will use that for its initial position, and there is no need to do any game object <-> event id tracking. @@ -6762,7 +6762,7 @@ DXDEC EXPAPI S32 AILCALL AIL_enqueue_event_start(); The enqueue process is still completely thread safe. No locks are used, however only 8 enqueues can be "assembling" at the same time - if more than that occur, the $AIL_enqueue_event_start - will yield the thread until a slot is open. + will yield the thread until a slot is open. The ONLY time that should happen is if events enqueues are started but never ended: @@ -6838,7 +6838,7 @@ DXDEC EXPAPI S32 AILCALL AIL_enqueue_event_buffer(S32* token, void* user_buffer, user buffer contents, and then exposed during sound enumeration. This is equivalent in spirit to the void* value that often accompanies callbacks. In this case, user_buffer_len is ignored, as user_buffer is never dereferenced. - $* <b>Buffer</b> If user_buffer_is_ptr is 0, then user_buffer_len bytes are copied from user_buffer and + $* <b>Buffer</b> If user_buffer_is_ptr is 0, then user_buffer_len bytes are copied from user_buffer and carried with the event. During sound enumeration this buffer is made available, and you never have to worry about memory management. $- @@ -6855,7 +6855,7 @@ DXDEC EXPAPI S32 AILCALL AIL_enqueue_event_buffer(S32* token, void* user_buffer, data->game_stat = 1; data->needed_info = 2; - // Pointer - the "data" pointer will be copied directly, so we can't free() "data" until after the sound + // Pointer - the "data" pointer will be copied directly, so we can't free() "data" until after the sound // completes and we're done using it in the enumeration loop. S32 ptr_token = AIL_enqueue_event_start(); AIL_enqueue_event_buffer(&ptr_token, data, 0, 1); @@ -6874,7 +6874,7 @@ DXDEC EXPAPI S32 AILCALL AIL_enqueue_event_buffer(S32* token, void* user_buffer, data.game_stat = 1; data.needed_info = 2; - // Buffer - the "data" structure will be copied internally, so we can free() the data - or just use + // Buffer - the "data" structure will be copied internally, so we can free() the data - or just use // a stack variable like this S32 buf_token = AIL_enqueue_event_start(); AIL_enqueue_event_buffer(&buf_token, &data, sizeof(data), 0); @@ -6895,7 +6895,7 @@ DXDEC EXPAPI S32 AILCALL AIL_enqueue_event_variablef(S32* token, char const* nam $:value The value of the variable to set. $:return 0 if the enqueue buffer is full - When a sound starts, the given variable will be set to the given value prior to any possible + When a sound starts, the given variable will be set to the given value prior to any possible references being used by presets. */ @@ -6904,7 +6904,7 @@ DXDEC EXPAPI S32 AILCALL AIL_enqueue_event_filter(S32* token, U64 apply_to_ID); Limits the effects of the event to sounds started by the given ID. $:token A token created with $AIL_enqueue_event_start - $:apply_to_ID The ID to use for filtering. This can be either a sound or event ID. For an + $:apply_to_ID The ID to use for filtering. This can be either a sound or event ID. For an event, it will apply to all sounds started by the event, and any events queued by that event. $:return 0 if the enqueue buffer is full @@ -6932,7 +6932,7 @@ DXDEC EXPAPI S32 AILCALL AIL_enqueue_event_selection(S32* token, U32 selection); $:selection The value to use for selecting the sound to play. $:return 0 if the enqueue buffer is full - The selection index is used to programatically select a sound from the + The selection index is used to programatically select a sound from the loaded banks. The index passed in replaces any numeric value at the end of the sound name existing in any start sound event step. For example, if a start sound event plays "mybank/sound1", and the event is queued with @@ -6969,52 +6969,52 @@ DXDEC EXPAPI U64 AILCALL AIL_enqueue_event_end_named(S32 token, char const* even As with all of the enqueue functions it is completely thread-safe. Upon completion of this function, the enqueue slot is release and available for another - $AIL_enqueue_event_start. + $AIL_enqueue_event_start. */ DXDEC EXPAPI U64 AILCALL AIL_enqueue_event(U8 const * event_or_name, void* user_buffer, S32 user_buffer_len, S32 enqueue_flags, U64 apply_to_ID ); /* Enqueue an event to be processed by the next $AIL_begin_event_queue_processing function. - - $:event_or_name Pointer to the event contents to queue, or the name of the event to find and queue. + + $:event_or_name Pointer to the event contents to queue, or the name of the event to find and queue. If an event, the contents must be valid until the next call to $AIL_begin_event_queue_processing. If a name, the string is copied internally and does not have any lifetime requirements, and MILES_ENQUEUE_BY_NAME must be present in enqueue_flags. - $:user_buffer Pointer to a user buffer. Depending on $(AIL_enqueue_event::enqueue_flags), this pointer can be saved directly, or its contents copied into the sound instance. - This data is then accessible later, when enumerating the instances. + $:user_buffer Pointer to a user buffer. Depending on $(AIL_enqueue_event::enqueue_flags), this pointer can be saved directly, or its contents copied into the sound instance. + This data is then accessible later, when enumerating the instances. $:user_buffer_len Size of the buffer pointed to by user_buffer. $:enqueue_flags Optional $MILESEVENTENQUEUEFLAGS logically OR'd together that control how to enqueue this event (default is 0). $:apply_to_ID Optional value that is used for events that affect sound instances. Normally, - when Miles triggers one of these event steps, it matches the name and labels stored with the event step. However, if + when Miles triggers one of these event steps, it matches the name and labels stored with the event step. However, if you specify an apply_to_ID value, then event step will only run on sounds that matches this QueuedID,InstanceID,or EventID too. This is how you - execute events only specific sound instances. QueuedIDs are returned from each call $AIL_enqueue_event. + execute events only specific sound instances. QueuedIDs are returned from each call $AIL_enqueue_event. InstanceIDs and EventIDs are returned from $AIL_enumerate_sound_instances. - $:return On success, returns QueuedID value that is unique to this queued event for the rest of this + $:return On success, returns QueuedID value that is unique to this queued event for the rest of this program run (you can use this ID to uniquely identify sounds triggered from this event). - + This function enqueues an event to be triggered - this is how you begin execution of an event. First, you queue it, and then later (usually once a game frame), you call $AIL_begin_event_queue_processing to execute an event. - - This function is very lightweight. It does nothing more than post the event and data to a + + This function is very lightweight. It does nothing more than post the event and data to a command buffer that gets executed via $AIL_begin_event_queue_processing. The user_buffer parameter can be used in different ways. If no flags are passed in, then Miles will copy the data from user_buffer (user_buffer_len bytes long) and store the data with the queued sound - you can then free the user_buffer data completely! This lets Miles keep track - of all your sound related memory directly and is the normal way to use the system (it is very + of all your sound related memory directly and is the normal way to use the system (it is very convenient once you get used to it). If you instead pass the MILESEVENT_ENQUEUE_BUFFER_PTR flag, then user_buffer pointer will simply be associated with each sound that this event may start. In this case, user_buffer_len is ignored. - - In both cases, when you later enumerate the sound instances, you can access your sound data + + In both cases, when you later enumerate the sound instances, you can access your sound data with the $(MILESEVENTSOUNDINFO::UserBuffer) field. - + You can call this function from any number threads - it's designed to be called from anywhere in your game. If you want events you queue to be captured by Miles Studio, then they have to be passed by name. This can be done - by either using the convenience function $AIL_enqueue_event_by_name, or by using the MILESEVENT_ENQUEUE_BY_NAME flag and + by either using the convenience function $AIL_enqueue_event_by_name, or by using the MILESEVENT_ENQUEUE_BY_NAME flag and passing the name in event_or_name. For introduction to the auditioning system, see $integrating_events. */ @@ -7044,23 +7044,23 @@ DXDEC EXPAPI S32 AILCALL AIL_begin_event_queue_processing( void ); /* Begin execution of all of the enqueued events. - $:return Return 0 on failure. The only failures are unrecoverable errors in the queued events + $:return Return 0 on failure. The only failures are unrecoverable errors in the queued events (out of memory, bank file not found, bad data, etc). You can get the specific error by calling $AIL_last_error. - + This function executes all the events currently in the queue. This is where all major processing takes place in the event system. - + Once you execute this functions, then sound instances will be in one of three states: - + $(MILESEVENTSOUNDSTATUS::MILESEVENT_SOUND_STATUS_PENDING)[MILESEVENT_SOUND_STATUS_PENDING] - these are new sound instances that were created by events that had a "Start Sound Step". Note that these instances aren't audible yet, so that you have a chance to modify game driven properties (like the 3D position) - on the sound before Miles begins to play it. - + on the sound before Miles begins to play it. + $(MILESEVENTSOUNDSTATUS::MILESEVENT_SOUND_STATUS_PLAYING)[MILESEVENT_SOUND_STATUS_PLAYING] - these are sound instances that were previously started and are continuing to play (you might update the 3D position for these, for example). - + $(MILESEVENTSOUNDSTATUS::MILESEVENT_SOUND_STATUS_COMPLETE)[MILESEVENT_SOUND_STATUS_COMPLETE] - these are sound instances that finished playing since the last this frame (you might use this status to free any game related memory, for example). @@ -7082,7 +7082,7 @@ ${ MILESEVENTSOUNDINFO Info; HMSSENUM SoundEnum = MSS_FIRST; - while ( $AIL_enumerate_sound_instances( &SoundEnum, MILESEVENT_SOUND_STATUS_PENDING | MILESEVENT_SOUND_STATUS_COMPLETE, 0, &Info ) ) + while ( $AIL_enumerate_sound_instances( &SoundEnum, MILESEVENT_SOUND_STATUS_PENDING | MILESEVENT_SOUND_STATUS_COMPLETE, 0, &Info ) ) { game_type * game_data = (game_type*) Info.UserBuffer; // returns the game_data pointer from the enqueue @@ -7098,13 +7098,13 @@ ${ } } - $AIL_complete_event_queue_processing( ); - $} - - Note that if any event step drastically fails, the rest of the command queue is + $AIL_complete_event_queue_processing( ); + $} + + Note that if any event step drastically fails, the rest of the command queue is skipped, and this function returns 0! For this reason, you shouldn't assume that a start sound event will always result in a completed sound later. - + Therefore, you should allocate memory that you want associated with a sound instance during the enumeration loop, rather than at enqueue time. Otherwise, you need to detect that the sound didn't start and then free the memory (which can be complicated). @@ -7120,7 +7120,7 @@ EXPTYPE typedef struct _MILESEVENTSOUNDINFO HSTREAM Stream; void* UserBuffer; S32 UserBufferLen; - S32 Status; + S32 Status; U32 Flags; S32 UsedDelay; F32 UsedVolume; @@ -7130,10 +7130,10 @@ EXPTYPE typedef struct _MILESEVENTSOUNDINFO } MILESEVENTSOUNDINFO; /* Sound instance data that is associated with each active sound instance. - + $:QueuedID A unique ID that identifies the queued event that started this sound. Returned from each call to $AIL_enqueue_event. $:EventID A unique ID that identifies the actual event that started this sound. This is the same as QueuedID unless the sound - was started by a completion event or a event exec step. In that case, the QueuedID represents the ID returned from + was started by a completion event or a event exec step. In that case, the QueuedID represents the ID returned from $AIL_enqueue_event, and EventID represents the completion event. $:InstanceID A unique ID that identified this specific sound instance (note that one QueuedID can trigger multiple InstanceIDs). $:Sample The $HSAMPLE for this playing sound. @@ -7148,7 +7148,7 @@ EXPTYPE typedef struct _MILESEVENTSOUNDINFO $:UsedSound The name of the sound used as a result of randomization. This pointer should NOT be deleted and is only valid for the until the next call in to Miles. $:HasCompletionEvent Nonzero if the sound will fire an event upon completion. - + This structure is returned by the $AIL_enumerate_sound_instances function. It returns information about an active sound instance. */ @@ -7157,7 +7157,7 @@ DXDEC EXPAPI void AILCALL AIL_set_variable_int(UINTa context, char const* name, /* Sets a named variable that the designer can reference in the tool. - $:context The context the variable is set for. Can be either a $HEVENTSYSTEM + $:context The context the variable is set for. Can be either a $HEVENTSYSTEM to set a global variable for a specific system, 0 to set a global variable for the default system, or an $HMSSENUM from $AIL_enumerate_sound_instances. $:name The name of the variable to set. @@ -7183,14 +7183,14 @@ DXDEC EXPAPI void AILCALL AIL_set_variable_int(UINTa context, char const* name, // A preset referencing "MyVar" for FirstSound will get 10. Any other sound will // get 20. $} - + */ DXDEC EXPAPI void AILCALL AIL_set_variable_float(UINTa context, char const* name, F32 value); /* Sets a named variable that the designer can reference in the tool. - $:context The context the variable is set for. Can be either a $HEVENTSYSTEM + $:context The context the variable is set for. Can be either a $HEVENTSYSTEM to set a global variable for a specific system, 0 to set a global variable for the default system, or an $HMSSENUM from $AIL_enumerate_sound_instances. $:name The name of the variable to set. @@ -7265,7 +7265,7 @@ DXDEC EXPAPI void AILCALL AIL_set_sound_start_offset(HMSSENUM sound, S32 offset, the sound starting. Generally you don't need to do this manually, since the sound designer should do this, however if you need to restart a sound that stopped - for example a stream that went to error - you will have to set the start position via code. - + However, since there can be a delay between the time the sound is first seen in the sound iteration and the time it gets set to the data, start positions set via the low level miles calls can get lost, so use this. @@ -7281,11 +7281,11 @@ DXDEC EXPAPI S32 AILCALL AIL_enumerate_sound_instances(HEVENTSYSTEM system, HMSS $:statuses Or-ed list of status values to enumerate. Use 0 for all status types. $:label_query A query to match sound instance labels against. Use 0 to skip label matching. $:search_for_ID Match only instances that have a QueuedID,InstanceID,or EventID that matches this value. Use 0 to skip ID matching. - $:info Returns the data for each sound instance. + $:info Returns the data for each sound instance. $:return Returns 0 when enumeration is complete. Enumerates the sound instances. This will generally be used between - calls to $AIL_begin_event_queue_processing and $AIL_complete_event_queue_processing to + calls to $AIL_begin_event_queue_processing and $AIL_complete_event_queue_processing to manage the sound instances. The label_query is a list of labels to match, separated by commas. By default, comma-separated @@ -7302,11 +7302,11 @@ DXDEC EXPAPI S32 AILCALL AIL_enumerate_sound_instances(HEVENTSYSTEM system, HMSS $(MILESEVENTSOUNDSTATUS::MILESEVENT_SOUND_STATUS_PENDING)[MILESEVENT_SOUND_STATUS_PENDING] - these are new sound instances that were created by events that had a "Start Sound Step". Note that these instances aren't audible yet, so that you have a chance to modify game driven properties (like the 3D position) - on the sound before Miles begins to play it. - + on the sound before Miles begins to play it. + $(MILESEVENTSOUNDSTATUS::MILESEVENT_SOUND_STATUS_PLAYING)[MILESEVENT_SOUND_STATUS_PLAYING] - these are sound instances that were previously started and are continuing to play (you might update the 3D position for these, for example). - + $(MILESEVENTSOUNDSTATUS::MILESEVENT_SOUND_STATUS_COMPLETE)[MILESEVENT_SOUND_STATUS_COMPLETE] - these are sound instances that finished playing since the last this frame (you might use this status to free any game related memory, for example). @@ -7315,7 +7315,7 @@ ${ HMSSENUM SoundEnum = MSS_FIRST; MILESEVENTSOUNDINFO Info; - while ( $AIL_enumerate_sound_instances( &SoundEnum, 0, 0, &Info ) ) + while ( $AIL_enumerate_sound_instances( &SoundEnum, 0, 0, &Info ) ) { if ( Info.Status != MILESEVENT_SOUND_STATUS_COMPLETE ) { @@ -7330,23 +7330,23 @@ $} EXPTYPEBEGIN typedef S32 MILESEVENTSOUNDSTATUS; #define MILESEVENT_SOUND_STATUS_PENDING 0x1 -#define MILESEVENT_SOUND_STATUS_PLAYING 0x2 +#define MILESEVENT_SOUND_STATUS_PLAYING 0x2 #define MILESEVENT_SOUND_STATUS_COMPLETE 0x4 EXPTYPEEND /* Specifies the status of a sound instance. - + $:MILESEVENT_SOUND_STATUS_PENDING New sound instances that were created by events that had a "Start Sound Step". Note that these instances aren't audible yet, so that you have a chance to modify game driven properties (like the 3D position) - on the sound before Miles begins to play it. - + on the sound before Miles begins to play it. + $:MILESEVENT_SOUND_STATUS_PLAYING Sound instances that were previously started and are continuing to play (you might update the 3D position for these, for example). - + $:MILESEVENT_SOUND_STATUS_COMPLETE Sound instances that finished playing since the last this frame (you might use this status to free any game related memory, for example). - + These are the status values that each sound instance can have. Use $AIL_enumerate_sound_instances to retrieve them. */ @@ -7360,13 +7360,13 @@ EXPTYPEBEGIN typedef U32 MILESEVENTSOUNDFLAG; EXPTYPEEND /* Specifies the status of a sound instance. - + $:MILESEVENT_SOUND_FLAG_MISSING_SOUND The event system tried to look up the sound requested from a Start Sound event and couldn't find anything in the loaded banks. $:MILESEVENT_SOUND_FLAG_EVICTED The sound was evicted due to a sound instance limit being hit. Another sound was selected as being higher priority, and this sound was stopped as a result. This can be the result of either a Label Sound Limit, or a limit on the sound itself. - $:MILESEVENT_SOUND_FLAG_WAITING_ASYNC The sound is pending because the data for it is currently being loaded. + $:MILESEVENT_SOUND_FLAG_WAITING_ASYNC The sound is pending because the data for it is currently being loaded. The sound will start when sufficient data has been loaded to hopefully avoid a skip. $:MILESEVENT_SONUD_FLAG_PENDING_ASYNC The sound has started playing, but the data still isn't completely loaded, and it's possible that the sound playback will catch up to the read position under poor I/O conditions. @@ -7375,7 +7375,7 @@ EXPTYPEEND sound data is asynchronously loaded, or specify the sound in a Cache Sounds step prior to attempting to start it. $:MILESEVENT_SOUND_FLAG_FAILED_ASYNC The sound tried to load and the asynchronous I/O operation failed - most likely either the media was removed during load, or the file was not found. - + These are the flag values that each sound instance can have. Use $AIL_enumerate_sound_instances to retrieve them. Instances may have more than one flag, logically 'or'ed together. */ @@ -7383,16 +7383,16 @@ EXPTYPEEND DXDEC EXPAPI S32 AILCALL AIL_complete_event_queue_processing( void ); /* Completes the queue processing (which is started with $AIL_begin_event_queue_processing ). - + $:return Returns 0 on failure. - This function must be called as a pair with $AIL_begin_event_queue_processing. - - In $AIL_begin_event_queue_processing, all the new sound instances are queued up, but they haven't - started playing yet. Old sound instances that have finished playing are still valid - they - haven't been freed yet. $AIL_complete_event_queue_processing actually starts the sound instances + This function must be called as a pair with $AIL_begin_event_queue_processing. + + In $AIL_begin_event_queue_processing, all the new sound instances are queued up, but they haven't + started playing yet. Old sound instances that have finished playing are still valid - they + haven't been freed yet. $AIL_complete_event_queue_processing actually starts the sound instances and frees the completed ones - it's the 2nd half of the event processing. - + Usually you call $AIL_enumerate_sound_instances before this function to manage all the sound instances. */ @@ -7400,7 +7400,7 @@ DXDEC EXPAPI S32 AILCALL AIL_complete_event_queue_processing( void ); DXDEC EXPAPI U64 AILCALL AIL_stop_sound_instances(char const * label_query, U64 apply_to_ID); /* Allows the programmer to manually enqueue a stop sound event into the event system. - + $:label_query A query to match sound instance labels against. Use 0 to skip label matching. $:apply_to_ID An optional value returned from a previous $AIL_enqueue_event or $AIL_enumerate_sound_instances that tells Miles to stop only those instances who's QueuedID,InstanceID,or EventID matches this value. @@ -7408,7 +7408,7 @@ DXDEC EXPAPI U64 AILCALL AIL_stop_sound_instances(char const * label_query, U64 Enqueues an event to stop all sounds matching the specified label query (see $AIL_enumerate_sound_instances for a description of the label_query format). - + Usually the programmer should trigger a named event that the sound designed can fill out to stop the necessary sounds, however, if a single sound (for example associated with an enemy that the player just killed) needs to be stopped, this function accomplishes that, and is captured by the auditioner for replay. @@ -7417,7 +7417,7 @@ DXDEC EXPAPI U64 AILCALL AIL_stop_sound_instances(char const * label_query, U64 DXDEC EXPAPI U64 AILCALL AIL_pause_sound_instances(char const * label_query, U64 apply_to_ID); /* Allows the programmer to manually enqueue a pause sound event into the event system. - + $:label_query A query to match sound instance labels against. Use 0 to skip label matching. $:apply_to_ID An optional value returned from a previous $AIL_enqueue_event or $AIL_enumerate_sound_instances that tells Miles to pause only those instances who's QueuedID,InstanceID,or EventID matches this value. @@ -7425,7 +7425,7 @@ DXDEC EXPAPI U64 AILCALL AIL_pause_sound_instances(char const * label_query, U64 Enqueues an event to pause all sounds matching the specified label query (see $AIL_enumerate_sound_instances for a description of the label_query format). - + Usually the programmer should trigger a named event that the sound designed can fill out to pause the necessary sounds, however, if a single sound (for example associated with an enemy that has been put in to stasis) needs to be paused, this function accomplishes that, and is captured by the auditioner for replay. @@ -7434,7 +7434,7 @@ DXDEC EXPAPI U64 AILCALL AIL_pause_sound_instances(char const * label_query, U64 DXDEC EXPAPI U64 AILCALL AIL_resume_sound_instances(char const * label_query, U64 apply_to_ID); /* Allows the programmer to manually enqueue a resume sound event into the event system. - + $:label_query A query to match sound instance labels against. Use 0 to skip label matching. $:apply_to_ID An optional value returned from a previous $AIL_enqueue_event or $AIL_enumerate_sound_instances that tells Miles to resume only those instances who's QueuedID,InstanceID,or EventID matches this value. @@ -7442,17 +7442,17 @@ DXDEC EXPAPI U64 AILCALL AIL_resume_sound_instances(char const * label_query, U6 Enqueues an event to resume all sounds matching the specified label query (see $AIL_enumerate_sound_instances for a description of the label_query format). - + Usually the programmer should trigger a named event that the sound designed can fill out to resume the necessary sounds, however, if a single sound (for example associated with an enemy that has been restored from stasis) needs to be resumed, this function accomplishes that, and is captured by the auditioner for replay. */ -DXDEC EXPAPI U64 AILCALL AIL_start_sound_instance(HMSOUNDBANK bank, char const * sound, U8 loop_count, +DXDEC EXPAPI U64 AILCALL AIL_start_sound_instance(HMSOUNDBANK bank, char const * sound, U8 loop_count, S32 should_stream, char const * labels, void* user_buffer, S32 user_buffer_len, S32 enqueue_flags ); /* Allows the programmer to manually enqueue a start sound event into the event system. - + $:bank The bank containing the sound to start. $:sound The name of the sound file to start, including bank name, e.g. "BankName/SoundName" $:loop_count The loop count to assign to the sound. 0 for infinite, 1 for play once, or just the number of times to loop. @@ -7463,10 +7463,10 @@ DXDEC EXPAPI U64 AILCALL AIL_start_sound_instance(HMSOUNDBANK bank, char const * $:enqueue_flags See the enqueue_flags description in $AIL_enqueue_event. $:return Returns a non-zero EnqueueID on success. - Enqueues an event to start the specified sound asset. - + Enqueues an event to start the specified sound asset. + Usually the programmer should trigger an event that the sound designer has specifically - create to start the appropriate sounds, but this function gives the programmer + create to start the appropriate sounds, but this function gives the programmer manual control, if necessary. <b>This function is not captured by the auditioner.</b> */ @@ -7488,7 +7488,7 @@ DXDEC EXPAPI S32 AILCALL AIL_set_sound_label_limits(HEVENTSYSTEM system, char co Every time an event triggers a sound to be played, the sound limits are checked, and, if exceeded, a sound is dropped (based on the settings in the event step). - + Usually event limits are set by a sound designer via an event, but this lets the programmer override the limits at runtime. Note that this replaces those events, it does not supplement. */ @@ -7503,7 +7503,7 @@ DXDEC EXPAPI S32 AILCALL AIL_enumerate_preset_persists(HEVENTSYSTEM system, HMSS that this pointer can change frame to frame and should be immediately copied to a client-allocated buffer if persistence is desired. $:return Returns 0 when enumeration is complete. - + This function lets you enumerate all the persisting presets that are currently active in the system. It is mostly a debugging aid. */ @@ -7511,12 +7511,12 @@ DXDEC EXPAPI S32 AILCALL AIL_enumerate_preset_persists(HEVENTSYSTEM system, HMSS DXDEC EXPAPI char * AILCALL AIL_text_dump_event_system(void); /* Returns a big string describing the current state of the event system. - - $:return String description of current systems state. + + $:return String description of current systems state. This function is a debugging aid - it can be used to show all of the active allocations, active sounds, etc. - + You must delete the pointer returned from this function with $AIL_mem_free_lock. */ @@ -7535,7 +7535,7 @@ EXPTYPE typedef struct _MILESEVENTSTATE } MILESEVENTSTATE; /* returns the current state of the Miles Event System. - + $:CommandBufferSize The size of the command buffer in bytes. See also the $AIL_startup_event_system. $:HeapSize The total size of memory used by the event system for management structures, and is allocated during startup. This does not include loaded file sizes. $:HeapRemaining The number of bytes in HeapSize that is remaining. @@ -7615,7 +7615,7 @@ EXPTYPE typedef struct _MILESBANKFUNCTIONS } MILESBANKFUNCTIONS; /* specifies callbacks for each of the Miles event system. - + $:FreeAll Callback that tells you to free all user-side bank memory. $:GetPreset Callback to retrieve a sound preset. $:GetEnvironment Callback to retrieve an environment preset. @@ -7645,13 +7645,13 @@ DXDEC EXPAPI void AILCALL AIL_set_event_sample_functions(HSAMPLE (*CreateSampleC In the callback, SoundName is the name of the asset in Miles Studio, and SoundFileName is the value returned from Container_GetSound() (see also $AIL_set_event_bank_functions). - + */ DXDEC EXPAPI void AILCALL AIL_set_event_bank_functions(MILESBANKFUNCTIONS const * Functions); /* Allows you to override the internal bank file resource management.. - + $:Functions A pointer to a structure containing all the callback functions. This function is used to completely override the high-level resource management system. @@ -7856,7 +7856,7 @@ EXPTYPEEND $:MILES_PLAT_IPHONE Apple iDevices $:MILES_PLAT_LINUX Linux Flavors $:MILES_PLAT_WII Nintendo Wii - $:MILES_PLAT_PSP2 Sony NGP + $:MILES_PLAT_PSP2 Sony NGP Values representing the various platforms the high level tool allows. */ @@ -7891,11 +7891,11 @@ EXPGROUP(Miles High Level Event System) DXDEC EXPAPI void AILCALL AIL_event_system_state(HEVENTSYSTEM system, MILESEVENTSTATE* state); /* Returns an information structure about the current state of the Miles Event System. - + $:system The system to retrieve information for, or zero for the default system. $:state A pointer to a structure to receive the state information. - This function is a debugging aid - it returns information for the event system. + This function is a debugging aid - it returns information for the event system. */ DXDEC EXPAPI U32 AILCALL AIL_event_system_command_queue_remaining(); @@ -7923,7 +7923,7 @@ DXDEC EXPAPI S32 AILCALL AIL_get_event_length(char const* i_EventName); // Callback for the error handler. EXPAPI typedef void AILCALLBACK AILEVENTERRORCB(S64 i_RelevantId, char const* i_Resource); /* - The function prototype to use for a callback that will be made when the event system + The function prototype to use for a callback that will be made when the event system encounters an unrecoverable error. $:i_RelevantId The ID of the asset that encountered the error, as best known. EventID or SoundID. @@ -7937,7 +7937,7 @@ EXPAPI typedef void AILCALLBACK AILEVENTERRORCB(S64 i_RelevantId, char const* i_ EXPAPI typedef S32 AILCALLBACK MSS_USER_RAND( void ); /* The function definition to use when defining your own random function. - + You can define a function with this prototype and pass it to $AIL_register_random if you want to tie the Miles random calls in with your game's (for logging and such). */ @@ -7953,7 +7953,7 @@ DXDEC EXPAPI void AILCALL AIL_set_event_error_callback(AILEVENTERRORCB * i_Error can sometimes be somewhat invisible. This function allows you to see what went wrong, when it went wrong. - The basic usage is to have the callback check $AIL_last_error() for the overall category of + The basic usage is to have the callback check $AIL_last_error() for the overall category of failure. The parameter passed to the callback might provide some context, but it can and will be zero on occasion. Generally it will represent the resource string that is being worked on when the error occurred. @@ -8009,7 +8009,7 @@ typedef C8 * (AILCALL *FLT_ERROR)(void); typedef HDRIVERSTATE (AILCALL *FLT_OPEN_DRIVER) (MSS_ALLOC_TYPE * palloc, MSS_FREE_TYPE * pfree, - UINTa user, + UINTa user, HDIGDRIVER dig, void * memory); typedef FLTRESULT (AILCALL *FLT_CLOSE_DRIVER) (HDRIVERSTATE state); diff --git a/Minecraft.Client/PSVita/Miles/include/rrCore.h b/Minecraft.Client/PSVita/Miles/include/rrCore.h index e88b5f8c..17ebee3a 100644 --- a/Minecraft.Client/PSVita/Miles/include/rrCore.h +++ b/Minecraft.Client/PSVita/Miles/include/rrCore.h @@ -114,8 +114,8 @@ #define __RADLITTLEENDIAN__ #ifdef __i386__ #define __RADX86__ - #else - #define __RADARM__ + #else + #define __RADARM__ #endif #define RADINLINE inline #define RADRESTRICT __restrict @@ -132,7 +132,7 @@ #define __RADX86__ #else #error Unknown processor -#endif +#endif #define __RADLITTLEENDIAN__ #define RADINLINE inline #define RADRESTRICT __restrict @@ -155,7 +155,7 @@ #define __RADNACL__ #define __RAD32__ #define __RADLITTLEENDIAN__ - #define __RADX86__ + #define __RADX86__ #define RADINLINE inline #define RADRESTRICT __restrict @@ -196,7 +196,7 @@ #define __RAD64REGS__ #define __RADLITTLEENDIAN__ #define RADINLINE inline - #define RADRESTRICT __restrict + #define RADRESTRICT __restrict #undef RADSTRUCT #define RADSTRUCT struct __attribute__((__packed__)) @@ -265,7 +265,7 @@ #endif #undef RADSTRUCT #define RADSTRUCT struct __attribute__((__packed__)) - + #elif defined(CAFE) // has to be before HOLLYWOOD_REV since it also defines it #define __RADWIIU__ @@ -480,7 +480,7 @@ #undef RADRESTRICT /* could have been defined above... */ #define RADRESTRICT __restrict - + #undef RADSTRUCT #define RADSTRUCT struct __attribute__((__packed__)) #endif @@ -885,7 +885,7 @@ #define RAD_ALIGN(type,var,num) type __declspec(align(num)) var #else // NOTE: / / is a guaranteed parse error in C/C++. - #define RAD_ALIGN(type,var,num) RAD_ALIGN_USED_BUT_NOT_DEFINED / / + #define RAD_ALIGN(type,var,num) RAD_ALIGN_USED_BUT_NOT_DEFINED / / #endif // WARNING : RAD_TLS should really only be used for debug/tools stuff @@ -917,8 +917,8 @@ #define RAD_S32 signed int // But pointers are 64 bits. #if (_MSC_VER >= 1300 && defined(_Wp64) && _Wp64 ) - #define RAD_SINTa __w64 signed __int64 - #define RAD_UINTa __w64 unsigned __int64 + #define RAD_SINTa __w64 signed long long + #define RAD_UINTa __w64 unsigned long long #else // non-vc.net compiler or /Wp64 turned off #define RAD_UINTa unsigned long long #define RAD_SINTa signed long long @@ -976,8 +976,8 @@ #define RAD_U64 unsigned long long #define RAD_S64 signed long long #elif defined(__RADX64__) || defined(__RAD32__) - #define RAD_U64 unsigned __int64 - #define RAD_S64 signed __int64 + #define RAD_U64 unsigned long long + #define RAD_S64 signed long long #else // 16-bit typedef RADSTRUCT RAD_U64 // do this so that we don't accidentally use U64s @@ -1134,7 +1134,7 @@ // helpers for doing an if ( ) with expect : // if ( RAD_LIKELY(expr) ) { ... } - + #define RAD_LIKELY(expr) RAD_EXPECT(expr,1) #define RAD_UNLIKELY(expr) RAD_EXPECT(expr,0) @@ -1324,7 +1324,7 @@ __pragma(warning(push)) \ __pragma(warning(disable:4127)) \ } while(0) \ - __pragma(warning(pop)) + __pragma(warning(pop)) #define RAD_STATEMENT_END_TRUE \ __pragma(warning(push)) \ @@ -1333,10 +1333,10 @@ __pragma(warning(pop)) #else - #define RAD_USE_STANDARD_LOOP_CONSTRUCT + #define RAD_USE_STANDARD_LOOP_CONSTRUCT #endif #else - #define RAD_USE_STANDARD_LOOP_CONSTRUCT + #define RAD_USE_STANDARD_LOOP_CONSTRUCT #endif #ifdef RAD_USE_STANDARD_LOOP_CONSTRUCT @@ -1345,7 +1345,7 @@ #define RAD_STATEMENT_END_FALSE \ } while ( (void)0,0 ) - + #define RAD_STATEMENT_END_TRUE \ } while ( (void)1,1 ) @@ -1355,7 +1355,7 @@ RAD_STATEMENT_START \ code \ RAD_STATEMENT_END_FALSE - + #define RAD_INFINITE_LOOP( code ) \ RAD_STATEMENT_START \ code \ @@ -1363,7 +1363,7 @@ // Must be placed after variable declarations for code compiled as .c -#if defined(_MSC_VER) && _MSC_VER >= 1700 // in 2012 aka 11.0 and later +#if defined(_MSC_VER) && _MSC_VER >= 1700 // in 2012 aka 11.0 and later # define RR_UNUSED_VARIABLE(x) (void) x #else # define RR_UNUSED_VARIABLE(x) (void)(sizeof(x)) @@ -1473,7 +1473,7 @@ // just to make gcc shut up about derefing null : #define RR_MEMBER_OFFSET_PTR(type,member,ptr) ( (SINTa) &(((type *)(ptr))->member) - (SINTa)(ptr) ) #define RR_MEMBER_SIZE_PTR(type,member,ptr) ( sizeof( ((type *) (ptr))->member) ) - + // MEMBER_TO_OWNER takes a pointer to a member and gives you back the base of the object // you should then RR_ASSERT( &(ret->member) == ptr ); #define RR_MEMBER_TO_OWNER(type,member,ptr) (type *)( ((char *)(ptr)) - RR_MEMBER_OFFSET_PTR(type,member,ptr) ) @@ -1482,7 +1482,7 @@ // Cache / prefetch macros : // RR_PREFETCH for various platforms : -// +// // RR_PREFETCH_SEQUENTIAL : prefetch memory for reading in a sequential scan // platforms that automatically prefetch sequential (eg. PC) should be a no-op here // RR_PREFETCH_WRITE_INVALIDATE : prefetch memory for writing - contents of memory are undefined @@ -1707,7 +1707,7 @@ extern fp_rrDisplayAssertion * g_fp_rrDisplayAssertion; #define rrDisplayAssertion(i,n,l,f,m) ( ( g_fp_rrDisplayAssertion ) ? (*g_fp_rrDisplayAssertion)(i,n,l,f,m) : 1 ) //----------------------------------------------------------- - + // RAD_NO_BREAK : option if you don't like your assert to break // CB : RR_BREAK is *always* a break ; RR_ASSERT_BREAK is optional #ifdef RAD_NO_BREAK @@ -1725,7 +1725,7 @@ extern fp_rrDisplayAssertion * g_fp_rrDisplayAssertion; #define RR_ASSERT_LITE_ALWAYS(exp) RAD_STATEMENT_WRAPPER( if ( ! (exp) ) { RR_ASSERT_BREAK(); } ) //----------------------------------- -#ifdef RR_DO_ASSERTS +#ifdef RR_DO_ASSERTS #define RR_ASSERT(exp) RR_ASSERT_ALWAYS(exp) #define RR_ASSERT_LITE(exp) RR_ASSERT_LITE_ALWAYS(exp) @@ -1883,7 +1883,7 @@ unsigned long __cdecl _byteswap_ulong (unsigned long _Long); #define RR_BSWAP16 _byteswap_ushort #define RR_BSWAP32 _byteswap_ulong -unsigned __int64 __cdecl _byteswap_uint64 (unsigned __int64 val); +unsigned long long __cdecl _byteswap_uint64 (unsigned long long val); #pragma intrinsic(_byteswap_uint64) #define RR_BSWAP64 _byteswap_uint64 @@ -1909,7 +1909,7 @@ RADFORCEINLINE unsigned long RR_BSWAP32 (unsigned long _Long) return _Long; } -RADFORCEINLINE unsigned __int64 RR_BSWAP64 (unsigned __int64 _Long) +RADFORCEINLINE unsigned long long RR_BSWAP64 (unsigned long long _Long) { __asm { mov eax, DWORD PTR _Long @@ -2250,10 +2250,10 @@ void __storewordbytereverse (unsigned int val, int offset, void *bas #if ( defined(_MSC_VER) && _MSC_VER >= 1300) -unsigned __int64 __cdecl _rotl64(unsigned __int64 _Val, int _Shift); +unsigned long long __cdecl _rotl64(unsigned long long _Val, int _Shift); #pragma intrinsic(_rotl64) -#define RR_ROTL64(x,k) _rotl64((unsigned __int64)(x),(int)(k)) +#define RR_ROTL64(x,k) _rotl64((unsigned long long)(x),(int)(k)) #elif defined(__RADCELL__) @@ -2262,7 +2262,7 @@ unsigned __int64 __cdecl _rotl64(unsigned __int64 _Val, int _Shift); #elif defined(__RADLINUX__) || defined(__RADMACAPI__) -//APTODO: Just to compile linux. Should we be doing better than this? If not, combine with above. +//APTODO: Just to compile linux. Should we be doing better than this? If not, combine with above. #define RR_ROTL64(u64,num) ( ( (u64) << (num) ) | ( (u64) >> (64 - (num))) ) #else diff --git a/Minecraft.Client/PSVita/Network/SonyRemoteStorage_Vita.cpp b/Minecraft.Client/PSVita/Network/SonyRemoteStorage_Vita.cpp index 3d9483d2..e739e92c 100644 --- a/Minecraft.Client/PSVita/Network/SonyRemoteStorage_Vita.cpp +++ b/Minecraft.Client/PSVita/Network/SonyRemoteStorage_Vita.cpp @@ -44,12 +44,12 @@ void SonyRemoteStorage_Vita::internalCallback(const SceRemoteStorageEvent event, break; case GET_DATA_RESULT: - if(retCode >= 0) + if(retCode >= 0) { app.DebugPrintf("Get Data success \n"); m_status = e_getDataSucceeded; - } - else + } + else { app.DebugPrintf("An error occurred while Get Data was being processed. retCode: 0x%x \n", retCode); m_status = e_error; @@ -66,12 +66,12 @@ void SonyRemoteStorage_Vita::internalCallback(const SceRemoteStorageEvent event, break; case GET_STATUS_RESULT: - if(retCode >= 0) + if(retCode >= 0) { app.DebugPrintf("Get Status success \n"); app.DebugPrintf("Remaining Syncs for this user: %llu\n", outputGetStatus->remainingSyncs); app.DebugPrintf("Number of files on the cloud: %d\n", outputGetStatus->numFiles); - for(int i = 0; i < outputGetStatus->numFiles; i++) + for(int i = 0; i < outputGetStatus->numFiles; i++) { app.DebugPrintf("\n*** File %d information: ***\n", (i + 1)); app.DebugPrintf("File name: %s \n", outputGetStatus->data[i].fileName); @@ -82,8 +82,8 @@ void SonyRemoteStorage_Vita::internalCallback(const SceRemoteStorageEvent event, app.DebugPrintf("Visibility: \"%s\" \n", (outputGetStatus->data[i].visibility == 0)?"Private":((outputGetStatus->data[i].visibility == 1)?"Public read only":"Public read and write")); } m_status = e_getStatusSucceeded; - } - else + } + else { app.DebugPrintf("An error occurred while Get Status was being processed. retCode: 0x%x \n", retCode); m_status = e_error; @@ -98,12 +98,12 @@ void SonyRemoteStorage_Vita::internalCallback(const SceRemoteStorageEvent event, break; case SET_DATA_RESULT: - if(retCode >= 0) + if(retCode >= 0) { app.DebugPrintf("Set Data success \n"); m_status = e_setDataSucceeded; - } - else + } + else { app.DebugPrintf("An error occurred while Set Data was being processed. retCode: 0x%x \n", retCode); m_status = e_error; @@ -175,19 +175,19 @@ bool SonyRemoteStorage_Vita::init(CallbackFunc cb, LPVOID lpParam) // SceNpAuthorizationCode authCode; // memset(&authCode, 0x0, sizeof(authCode)); - + SceNpAuthGetAuthorizationCodeParameter authParams; - memset(&authParams, 0x0, sizeof(authParams)); + memset(&authParams, 0x0, sizeof(authParams)); authParams.size = sizeof(authParams); - authParams.pScope = AUTH_SCOPE; + authParams.pScope = AUTH_SCOPE; memcpy(clientId.id, CLIENT_ID, strlen(CLIENT_ID)); - authParams.pClientId = &clientId; + authParams.pClientId = &clientId; int issuerId = 0; // ret = sceNpAuthGetAuthorizationCode(reqId, &authParams, &authCode, &issuerId); -// if (ret < 0) +// if (ret < 0) // { // app.DebugPrintf("Failed to get auth code 0x%x\n", ret); // sceNpAuthDeleteOAuthRequest(reqId); @@ -195,7 +195,7 @@ bool SonyRemoteStorage_Vita::init(CallbackFunc cb, LPVOID lpParam) // } ret = sceNpAuthDeleteOAuthRequest(reqId); - if (ret < 0) + if (ret < 0) { app.DebugPrintf("Couldn't delete auth request 0x%x\n", ret); return false; @@ -221,11 +221,11 @@ bool SonyRemoteStorage_Vita::init(CallbackFunc cb, LPVOID lpParam) SceRemoteStorageAbortReqParams abortParams; ret = sceRemoteStorageInit(params); - if(ret >= 0) + if(ret >= 0) { abortParams.requestId = ret; app.DebugPrintf("Session will be created \n"); - } + } else if(ret == SCE_REMOTE_STORAGE_ERROR_ALREADY_INITIALISED) { app.DebugPrintf("Session already created \n"); @@ -251,12 +251,12 @@ bool SonyRemoteStorage_Vita::getRemoteFileInfo(SceRemoteStorageStatus* pInfo, Ca reqId = sceRemoteStorageGetStatus(params, outputGetStatus); m_status = e_getStatusInProgress; - if(reqId >= 0) + if(reqId >= 0) { app.DebugPrintf("Get Status request sent \n"); return true; - } - else + } + else { app.DebugPrintf("Error sending Get Status request: 0x%x \n", reqId); return false; @@ -275,11 +275,11 @@ void SonyRemoteStorage_Vita::abort() params.requestId = reqId; int ret = sceRemoteStorageAbort(params); - if(ret >= 0) + if(ret >= 0) { app.DebugPrintf("Abort request done \n"); - } - else + } + else { app.DebugPrintf("Error in Abort request: 0x%x \n", ret); } @@ -317,7 +317,7 @@ bool SonyRemoteStorage_Vita::setDataInternal() char seed[22]; app.GetImageTextData(m_thumbnailData, m_thumbnailDataSize,(unsigned char *)seed, uiHostOptions, bHostOptionsRead, uiTexturePack); - __int64 iSeed = strtoll(seed,NULL,10); + int64_t iSeed = strtoll(seed,NULL,10); char seedHex[17]; sprintf(seedHex,"%016llx",iSeed); memcpy(descData.m_seed,seedHex,16); // Don't copy null @@ -345,13 +345,13 @@ bool SonyRemoteStorage_Vita::setDataInternal() reqId = sceRemoteStorageSetData(params); app.DebugPrintf("\n*******************************\n"); - if(reqId >= 0) + if(reqId >= 0) { app.DebugPrintf("Set Data request sent \n"); m_bTransferStarted = true; return true; - } - else + } + else { app.DebugPrintf("Error sending Set Data request: 0x%x \n", reqId); return false; @@ -374,13 +374,13 @@ bool SonyRemoteStorage_Vita::getData( const char* remotePath, const char* localP reqId = sceRemoteStorageGetData(params, &s_getDataOutput); app.DebugPrintf("\n*******************************\n"); - if(reqId >= 0) + if(reqId >= 0) { app.DebugPrintf("Get Data request sent \n"); m_bTransferStarted = true; return true; - } - else + } + else { app.DebugPrintf("Error sending Get Data request: 0x%x \n", reqId); return false; diff --git a/Minecraft.Client/PSVita/PSVitaExtras/PSVitaStubs.h b/Minecraft.Client/PSVita/PSVitaExtras/PSVitaStubs.h index 180ebbbc..9e24befa 100644 --- a/Minecraft.Client/PSVita/PSVitaExtras/PSVitaStubs.h +++ b/Minecraft.Client/PSVita/PSVitaExtras/PSVitaStubs.h @@ -26,7 +26,7 @@ DWORD TlsAlloc(VOID); LPVOID TlsGetValue(DWORD dwTlsIndex); BOOL TlsSetValue(DWORD dwTlsIndex, LPVOID lpTlsValue); -typedef struct _RECT +typedef struct _RECT { LONG left; LONG top; @@ -34,13 +34,13 @@ typedef struct _RECT LONG bottom; } RECT, *PRECT; -typedef struct _TOUCHSCREENRECT +typedef struct _TOUCHSCREENRECT { SceInt16 left; SceInt16 top; SceInt16 right; SceInt16 bottom; -} +} TOUCHSCREENRECT, *PTOUCHSCREENRECT; typedef void ID3D11Device; @@ -58,16 +58,16 @@ typedef int errno_t; // // The following field is used for blocking when there is contention for // // the resource // // -// +// // union { // ULONG_PTR RawEvent[4]; // } Synchronization; -// +// // // // // The following three fields control entering and exiting the critical // // section for the resource // // -// +// // LONG LockCount; // LONG RecursionCount; // HANDLE OwningThread; @@ -261,7 +261,7 @@ typedef struct _MEMORYSTATUS { #define THREAD_PRIORITY_IDLE THREAD_BASE_PRIORITY_IDLE #define WAIT_TIMEOUT 258L -#define STATUS_ABANDONED_WAIT_0 ((DWORD )0x00000080L) +#define STATUS_ABANDONED_WAIT_0 ((DWORD )0x00000080L) #define WAIT_ABANDONED ((STATUS_ABANDONED_WAIT_0 ) + 0 ) #define MAXUINT_PTR (~((UINT_PTR)0)) @@ -303,17 +303,17 @@ typedef struct _MEMORYSTATUS { #define GENERIC_EXECUTE (0x20000000L) #define GENERIC_ALL (0x10000000L) -#define FILE_SHARE_READ 0x00000001 -#define FILE_SHARE_WRITE 0x00000002 -#define FILE_SHARE_DELETE 0x00000004 -#define FILE_ATTRIBUTE_READONLY 0x00000001 -#define FILE_ATTRIBUTE_HIDDEN 0x00000002 -#define FILE_ATTRIBUTE_SYSTEM 0x00000004 -#define FILE_ATTRIBUTE_DIRECTORY 0x00000010 -#define FILE_ATTRIBUTE_ARCHIVE 0x00000020 -#define FILE_ATTRIBUTE_DEVICE 0x00000040 -#define FILE_ATTRIBUTE_NORMAL 0x00000080 -#define FILE_ATTRIBUTE_TEMPORARY 0x00000100 +#define FILE_SHARE_READ 0x00000001 +#define FILE_SHARE_WRITE 0x00000002 +#define FILE_SHARE_DELETE 0x00000004 +#define FILE_ATTRIBUTE_READONLY 0x00000001 +#define FILE_ATTRIBUTE_HIDDEN 0x00000002 +#define FILE_ATTRIBUTE_SYSTEM 0x00000004 +#define FILE_ATTRIBUTE_DIRECTORY 0x00000010 +#define FILE_ATTRIBUTE_ARCHIVE 0x00000020 +#define FILE_ATTRIBUTE_DEVICE 0x00000040 +#define FILE_ATTRIBUTE_NORMAL 0x00000080 +#define FILE_ATTRIBUTE_TEMPORARY 0x00000100 #define FILE_FLAG_WRITE_THROUGH 0x80000000 #define FILE_FLAG_OVERLAPPED 0x40000000 @@ -333,38 +333,38 @@ typedef struct _MEMORYSTATUS { #define OPEN_ALWAYS 4 #define TRUNCATE_EXISTING 5 -#define PAGE_NOACCESS 0x01 -#define PAGE_READONLY 0x02 -#define PAGE_READWRITE 0x04 -#define PAGE_WRITECOPY 0x08 -#define PAGE_EXECUTE 0x10 -#define PAGE_EXECUTE_READ 0x20 -#define PAGE_EXECUTE_READWRITE 0x40 -#define PAGE_EXECUTE_WRITECOPY 0x80 -#define PAGE_GUARD 0x100 -#define PAGE_NOCACHE 0x200 -#define PAGE_WRITECOMBINE 0x400 -#define PAGE_USER_READONLY 0x1000 -#define PAGE_USER_READWRITE 0x2000 -#define MEM_COMMIT 0x1000 -#define MEM_RESERVE 0x2000 -#define MEM_DECOMMIT 0x4000 -#define MEM_RELEASE 0x8000 -#define MEM_FREE 0x10000 -#define MEM_PRIVATE 0x20000 -#define MEM_RESET 0x80000 -#define MEM_TOP_DOWN 0x100000 -#define MEM_NOZERO 0x800000 -#define MEM_LARGE_PAGES 0x20000000 -#define MEM_HEAP 0x40000000 -#define MEM_16MB_PAGES 0x80000000 +#define PAGE_NOACCESS 0x01 +#define PAGE_READONLY 0x02 +#define PAGE_READWRITE 0x04 +#define PAGE_WRITECOPY 0x08 +#define PAGE_EXECUTE 0x10 +#define PAGE_EXECUTE_READ 0x20 +#define PAGE_EXECUTE_READWRITE 0x40 +#define PAGE_EXECUTE_WRITECOPY 0x80 +#define PAGE_GUARD 0x100 +#define PAGE_NOCACHE 0x200 +#define PAGE_WRITECOMBINE 0x400 +#define PAGE_USER_READONLY 0x1000 +#define PAGE_USER_READWRITE 0x2000 +#define MEM_COMMIT 0x1000 +#define MEM_RESERVE 0x2000 +#define MEM_DECOMMIT 0x4000 +#define MEM_RELEASE 0x8000 +#define MEM_FREE 0x10000 +#define MEM_PRIVATE 0x20000 +#define MEM_RESET 0x80000 +#define MEM_TOP_DOWN 0x100000 +#define MEM_NOZERO 0x800000 +#define MEM_LARGE_PAGES 0x20000000 +#define MEM_HEAP 0x40000000 +#define MEM_16MB_PAGES 0x80000000 #define IGNORE 0 // Ignore signal #define INFINITE 0xFFFFFFFF // Infinite timeout #define WAIT_FAILED ((DWORD)0xFFFFFFFF) -#define STATUS_WAIT_0 ((DWORD )0x00000000L) +#define STATUS_WAIT_0 ((DWORD )0x00000000L) #define WAIT_OBJECT_0 ((STATUS_WAIT_0 ) + 0 ) -#define STATUS_PENDING ((DWORD )0x00000103L) +#define STATUS_PENDING ((DWORD )0x00000103L) #define STILL_ACTIVE STATUS_PENDING DWORD GetLastError(VOID); @@ -403,9 +403,9 @@ VOID OutputDebugString(LPCSTR lpOutputString); VOID OutputDebugStringA(LPCSTR lpOutputString); errno_t _itoa_s(int _Value, char * _DstBuf, size_t _Size, int _Radix); -errno_t _i64toa_s(__int64 _Val, char * _DstBuf, size_t _Size, int _Radix); +errno_t _i64toa_s(int64_t _Val, char * _DstBuf, size_t _Size, int _Radix); -#define __declspec(a) +#define __declspec(a) extern "C" int _wcsicmp (const wchar_t * dst, const wchar_t * src); size_t wcsnlen(const wchar_t *wcs, size_t maxsize); diff --git a/Minecraft.Client/PSVita/PSVitaExtras/PSVitaTypes.h b/Minecraft.Client/PSVita/PSVitaExtras/PSVitaTypes.h index cc2ddddb..36402d53 100644 --- a/Minecraft.Client/PSVita/PSVitaExtras/PSVitaTypes.h +++ b/Minecraft.Client/PSVita/PSVitaExtras/PSVitaTypes.h @@ -34,14 +34,12 @@ typedef unsigned int *PUINT; typedef unsigned char byte; -typedef long long __int64; -typedef unsigned long long __uint64; typedef unsigned int DWORD; typedef int INT; typedef unsigned long ULONG_PTR, *PULONG_PTR; typedef ULONG_PTR SIZE_T, *PSIZE_T; -typedef __int64 LONG64, *PLONG64; +typedef int64_t LONG64, *PLONG64; #define VOID void typedef char CHAR; diff --git a/Minecraft.Client/PSVita/PSVitaExtras/PsVitaStubs.cpp b/Minecraft.Client/PSVita/PSVitaExtras/PsVitaStubs.cpp index 87c59535..56eb9654 100644 --- a/Minecraft.Client/PSVita/PSVitaExtras/PsVitaStubs.cpp +++ b/Minecraft.Client/PSVita/PSVitaExtras/PsVitaStubs.cpp @@ -56,42 +56,42 @@ void PSVitaInit() int err = sceFiosInitialize(¶ms); assert(err == SCE_FIOS_OK); } -char* getConsoleHomePath() -{ - return contentInfoPath; +char* getConsoleHomePath() +{ + return contentInfoPath; } -char* getUsrDirRoot() -{ - return driveRoot; +char* getUsrDirRoot() +{ + return driveRoot; } -char* getUsrDirPath() -{ - return usrdirPath; +char* getUsrDirPath() +{ + return usrdirPath; } -char* getConsoleHomePathBDPatch() -{ - return contentInfoPathBDPatch; +char* getConsoleHomePathBDPatch() +{ + return contentInfoPathBDPatch; } -char* getUsrDirPathBDPatch() -{ - return usrdirPathBDPatch; +char* getUsrDirPathBDPatch() +{ + return usrdirPathBDPatch; } -char* getDirName() -{ - return dirName; +char* getDirName() +{ + return dirName; } int _wcsicmp( const wchar_t * dst, const wchar_t * src ) { wchar_t f,l; - // validation section + // validation section // _VALIDATE_RETURN(dst != NULL, EINVAL, _NLSCMPERROR); // _VALIDATE_RETURN(src != NULL, EINVAL, _NLSCMPERROR); @@ -117,7 +117,7 @@ size_t wcsnlen(const wchar_t *wcs, size_t maxsize) return n; } -VOID GetSystemTime( LPSYSTEMTIME lpSystemTime) +VOID GetSystemTime( LPSYSTEMTIME lpSystemTime) { SceDateTime dateTime; int err = sceRtcGetCurrentClock(&dateTime, 0); @@ -133,8 +133,8 @@ VOID GetSystemTime( LPSYSTEMTIME lpSystemTime) lpSystemTime->wMilliseconds = sceRtcGetMicrosecond(&dateTime)/1000; } BOOL FileTimeToSystemTime(CONST FILETIME *lpFileTime, LPSYSTEMTIME lpSystemTime) { PSVITA_STUBBED; return false; } -BOOL SystemTimeToFileTime(CONST SYSTEMTIME *lpSystemTime, LPFILETIME lpFileTime) -{ +BOOL SystemTimeToFileTime(CONST SYSTEMTIME *lpSystemTime, LPFILETIME lpFileTime) +{ SceUInt64 diffHundredNanos; SceDateTime dateTime; int err = sceRtcGetCurrentClock(&dateTime, 0); @@ -143,11 +143,11 @@ BOOL SystemTimeToFileTime(CONST SYSTEMTIME *lpSystemTime, LPFILETIME lpFileTime) lpFileTime->dwHighDateTime = diffHundredNanos >> 32; lpFileTime->dwLowDateTime = diffHundredNanos & 0xffffffff; - return true; + return true; } -VOID GetLocalTime(LPSYSTEMTIME lpSystemTime) -{ +VOID GetLocalTime(LPSYSTEMTIME lpSystemTime) +{ SceDateTime dateTime; int err = sceRtcGetCurrentClockLocalTime(&dateTime); assert(err == SCE_OK); @@ -163,26 +163,26 @@ VOID GetLocalTime(LPSYSTEMTIME lpSystemTime) } HANDLE CreateEvent(void* lpEventAttributes, BOOL bManualReset, BOOL bInitialState, LPCSTR lpName) { PSVITA_STUBBED; return NULL; } -VOID Sleep(DWORD dwMilliseconds) -{ +VOID Sleep(DWORD dwMilliseconds) +{ C4JThread::Sleep(dwMilliseconds); } BOOL SetThreadPriority(HANDLE hThread, int nPriority) { PSVITA_STUBBED; return FALSE; } DWORD WaitForSingleObject(HANDLE hHandle, DWORD dwMilliseconds) { PSVITA_STUBBED; return false; } -LONG InterlockedCompareExchangeRelease(LONG volatile *Destination, LONG Exchange,LONG Comperand ) -{ +LONG InterlockedCompareExchangeRelease(LONG volatile *Destination, LONG Exchange,LONG Comperand ) +{ return sceAtomicCompareAndSwap32((int32_t*)Destination, (int32_t)Comperand, (int32_t)Exchange); } -LONG64 InterlockedCompareExchangeRelease64(LONG64 volatile *Destination, LONG64 Exchange, LONG64 Comperand) -{ +LONG64 InterlockedCompareExchangeRelease64(LONG64 volatile *Destination, LONG64 Exchange, LONG64 Comperand) +{ return sceAtomicCompareAndSwap64((int64_t*)Destination, (int64_t)Comperand, (int64_t)Exchange); } -VOID InitializeCriticalSection(PCRITICAL_SECTION CriticalSection) +VOID InitializeCriticalSection(PCRITICAL_SECTION CriticalSection) { char name[1] = {0}; @@ -191,7 +191,7 @@ VOID InitializeCriticalSection(PCRITICAL_SECTION CriticalSection) } -VOID InitializeCriticalSectionAndSpinCount(PCRITICAL_SECTION CriticalSection, ULONG SpinCount) +VOID InitializeCriticalSectionAndSpinCount(PCRITICAL_SECTION CriticalSection, ULONG SpinCount) { // no spin count on PSVita InitializeCriticalSection(CriticalSection); @@ -203,16 +203,16 @@ VOID DeleteCriticalSection(PCRITICAL_SECTION CriticalSection) PSVITA_ASSERT_SCE_ERROR(err); } -extern CRITICAL_SECTION g_singleThreadCS; +extern CRITICAL_SECTION g_singleThreadCS; -VOID EnterCriticalSection(PCRITICAL_SECTION CriticalSection) +VOID EnterCriticalSection(PCRITICAL_SECTION CriticalSection) { int err = sceKernelLockLwMutex ((SceKernelLwMutexWork *)(&CriticalSection->mutex), 1, NULL); PSVITA_ASSERT_SCE_ERROR(err); } -VOID LeaveCriticalSection(PCRITICAL_SECTION CriticalSection) +VOID LeaveCriticalSection(PCRITICAL_SECTION CriticalSection) { int err = sceKernelUnlockLwMutex ((SceKernelLwMutexWork *)(&CriticalSection->mutex), 1); PSVITA_ASSERT_SCE_ERROR(err); @@ -272,8 +272,8 @@ VOID LeaveCriticalRWSection(PCRITICAL_RW_SECTION CriticalSection, bool Write) -BOOL CloseHandle(HANDLE hObject) -{ +BOOL CloseHandle(HANDLE hObject) +{ sceFiosFHCloseSync(NULL,(SceFiosFH)((int32_t)hObject)); return true; } @@ -292,8 +292,8 @@ BOOL TlsSetValue(DWORD dwTlsIndex, LPVOID lpTlsValue) { return PSVitaTLSStorage: static void* VirtualAllocs[1000]; // a list of 1MB allocations static int VirtualNumAllocs = 0; // how many 1MB chunks have been allocated -LPVOID VirtualAlloc(LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect) -{ +LPVOID VirtualAlloc(LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect) +{ if( flAllocationType == MEM_COMMIT ) { // how many pages do we need @@ -318,7 +318,7 @@ LPVOID VirtualAlloc(LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWO return (void*) VIRTUAL_OFFSET; } -BOOL VirtualFree(LPVOID lpAddress, SIZE_T dwSize, DWORD dwFreeType) +BOOL VirtualFree(LPVOID lpAddress, SIZE_T dwSize, DWORD dwFreeType) { while( VirtualNumAllocs ) { @@ -332,7 +332,7 @@ BOOL VirtualFree(LPVOID lpAddress, SIZE_T dwSize, DWORD dwFreeType) // memset a section of the virtual chunks -VOID VirtualMemset(LPVOID lpDestOffset, int val, SIZE_T dwSize) +VOID VirtualMemset(LPVOID lpDestOffset, int val, SIZE_T dwSize) { int DestOffset = ((int)(lpDestOffset) - VIRTUAL_OFFSET); // convert the pointer back into a virtual offset int StartPage = DestOffset / VIRTUAL_PAGE_SIZE; // which 1MB page do we start on @@ -370,7 +370,7 @@ VOID VirtualMemset(LPVOID lpDestOffset, int val, SIZE_T dwSize) // copy a block of memory to the virtual chunks -VOID VirtualCopyTo(LPVOID lpDestOffset, LPVOID lpSrc, SIZE_T dwSize) +VOID VirtualCopyTo(LPVOID lpDestOffset, LPVOID lpSrc, SIZE_T dwSize) { int DestOffset = ((int)(lpDestOffset) - VIRTUAL_OFFSET); // convert the pointer back into a virtual offset int StartPage = DestOffset / VIRTUAL_PAGE_SIZE; // which 1MB page do we start on @@ -409,7 +409,7 @@ VOID VirtualCopyTo(LPVOID lpDestOffset, LPVOID lpSrc, SIZE_T dwSize) } // copy a block of memory from the virtual chunks -VOID VirtualCopyFrom(LPVOID lpDest, LPVOID lpSrcOffset, SIZE_T dwSize) +VOID VirtualCopyFrom(LPVOID lpDest, LPVOID lpSrcOffset, SIZE_T dwSize) { int SrcOffset = ((int)(lpSrcOffset) - VIRTUAL_OFFSET); // convert the pointer back into a virtual offset int StartPage = SrcOffset / VIRTUAL_PAGE_SIZE; // which 1MB page do we start on @@ -448,7 +448,7 @@ VOID VirtualCopyFrom(LPVOID lpDest, LPVOID lpSrcOffset, SIZE_T dwSize) } // copy a block of memory between the virtual chunks -VOID VirtualMove(LPVOID lpDestOffset, LPVOID lpSrcOffset, SIZE_T dwSize) +VOID VirtualMove(LPVOID lpDestOffset, LPVOID lpSrcOffset, SIZE_T dwSize) { int DestOffset = ((int)(lpDestOffset) - VIRTUAL_OFFSET); // convert the pointer back into a virtual offset int DestChunkOffset = DestOffset % VIRTUAL_PAGE_SIZE; // what is the byte offset within the current 1MB page @@ -651,7 +651,7 @@ DWORD GetFileSize( HANDLE hFile, LPDWORD lpFileSizeHigh ) { SceFiosFH fh = (SceFiosFH)(hFile); - // 4J Stu - sceFiosFHGetSize didn't seem to work...so doing this for now + // 4J Stu - sceFiosFHGetSize didn't seem to work...so doing this for now //SceFiosSize FileSize; //FileSize=sceFiosFHGetSize(fh); SceFiosStat statData; @@ -693,7 +693,7 @@ BOOL WriteFile( HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, LPD return FALSE; } -BOOL ReadFile(HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped ) +BOOL ReadFile(HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped ) { SceFiosFH fh = (SceFiosFH)((int64_t)hFile); // sceFiosFHReadSync - Non-negative values are the number of bytes read, 0 <= result <= length. Negative values are error codes. @@ -742,7 +742,7 @@ void replaceBackslashes(char* szFilename) } } -HANDLE CreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile) +HANDLE CreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile) { char filePath[256]; std::string mountedPath = StorageManager.GetMountedPath(lpFileName); @@ -767,7 +767,7 @@ HANDLE CreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, #ifndef _CONTENT_PACKAGE printf("*** Opening %s\n",filePath); #endif - + SceFiosFH fh; int err = sceFiosFHOpenSync(NULL, &fh, filePath, NULL); assert( err == SCE_FIOS_OK ); @@ -775,8 +775,8 @@ HANDLE CreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, return (void*)fh; } -BOOL CreateDirectoryA(LPCSTR lpPathName, LPSECURITY_ATTRIBUTES lpSecurityAttributes) -{ +BOOL CreateDirectoryA(LPCSTR lpPathName, LPSECURITY_ATTRIBUTES lpSecurityAttributes) +{ #ifndef _CONTENT_PACKAGE char filePath[256]; sprintf(filePath,"%s/%s",usrdirPath, lpPathName ); @@ -793,12 +793,12 @@ BOOL CreateDirectoryA(LPCSTR lpPathName, LPSECURITY_ATTRIBUTES lpSecurityAttribu BOOL DeleteFileA(LPCSTR lpFileName) { PSVITA_STUBBED; return false; } -// BOOL XCloseHandle(HANDLE a) -// { -// cellFsClose(int(a)); +// BOOL XCloseHandle(HANDLE a) +// { +// cellFsClose(int(a)); // } -DWORD GetFileAttributesA(LPCSTR lpFileName) +DWORD GetFileAttributesA(LPCSTR lpFileName) { char filePath[256]; std::string mountedPath = StorageManager.GetMountedPath(lpFileName); @@ -834,7 +834,7 @@ VOID DebugBreak(VOID) { SCE_BREAK(); } DWORD GetLastError(VOID) { PSVITA_STUBBED; return 0; } -VOID GlobalMemoryStatus(LPMEMORYSTATUS lpBuffer) +VOID GlobalMemoryStatus(LPMEMORYSTATUS lpBuffer) { PSVITA_STUBBED; /* malloc_managed_size stat; @@ -849,9 +849,9 @@ VOID GlobalMemoryStatus(LPMEMORYSTATUS lpBuffer) lpBuffer->dwAvailVirtual = stat.max_system_size - stat.current_inuse_size;*/ } -DWORD GetTickCount() +DWORD GetTickCount() { - // This function returns the current system time at this function is called. + // This function returns the current system time at this function is called. // The system time is represented the time elapsed since the system starts up in microseconds. uint64_t sysTime = sceKernelGetProcessTimeWide(); @@ -860,11 +860,11 @@ DWORD GetTickCount() } // we should really use libperf for this kind of thing, but this will do for now. -BOOL QueryPerformanceFrequency(LARGE_INTEGER *lpFrequency) -{ +BOOL QueryPerformanceFrequency(LARGE_INTEGER *lpFrequency) +{ // microseconds - lpFrequency->QuadPart = (1000 * 1000); - return false; + lpFrequency->QuadPart = (1000 * 1000); + return false; } BOOL QueryPerformanceCounter(LARGE_INTEGER *lpPerformanceCount) { @@ -874,24 +874,24 @@ BOOL QueryPerformanceCounter(LARGE_INTEGER *lpPerformanceCount) } #ifndef _FINAL_BUILD -VOID OutputDebugStringW(LPCWSTR lpOutputString) -{ - wprintf(lpOutputString); +VOID OutputDebugStringW(LPCWSTR lpOutputString) +{ + wprintf(lpOutputString); } -VOID OutputDebugString(LPCSTR lpOutputString) -{ - printf(lpOutputString); +VOID OutputDebugString(LPCSTR lpOutputString) +{ + printf(lpOutputString); } -VOID OutputDebugStringA(LPCSTR lpOutputString) -{ - printf(lpOutputString); +VOID OutputDebugStringA(LPCSTR lpOutputString) +{ + printf(lpOutputString); } #endif // _CONTENT_PACKAGE BOOL GetFileAttributesExA(LPCSTR lpFileName,GET_FILEEX_INFO_LEVELS fInfoLevelId,LPVOID lpFileInformation) -{ +{ WIN32_FILE_ATTRIBUTE_DATA *fileInfoBuffer = (WIN32_FILE_ATTRIBUTE_DATA*) lpFileInformation; char filePath[256]; @@ -920,32 +920,32 @@ BOOL GetFileAttributesExA(LPCSTR lpFileName,GET_FILEEX_INFO_LEVELS fInfoLevelId, } HANDLE FindFirstFileA(LPCSTR lpFileName, LPWIN32_FIND_DATA lpFindFileData) -{ - PSVITA_STUBBED; +{ + PSVITA_STUBBED; return 0; } -BOOL FindNextFileA(HANDLE hFindFile, LPWIN32_FIND_DATAA lpFindFileData) -{ +BOOL FindNextFileA(HANDLE hFindFile, LPWIN32_FIND_DATAA lpFindFileData) +{ PSVITA_STUBBED; return false; } errno_t _itoa_s(int _Value, char * _DstBuf, size_t _Size, int _Radix) { if(_Radix==10) sprintf(_DstBuf,"%d",_Value); else if(_Radix==16) sprintf(_DstBuf,"%lx",_Value); else return -1; return 0; } -errno_t _i64toa_s(__int64 _Val, char * _DstBuf, size_t _Size, int _Radix) { if(_Radix==10) sprintf(_DstBuf,"%lld",_Val); else return -1; return 0; } +errno_t _i64toa_s(int64_t _Val, char * _DstBuf, size_t _Size, int _Radix) { if(_Radix==10) sprintf(_DstBuf,"%lld",_Val); else return -1; return 0; } int _wtoi(const wchar_t *_Str) { return wcstol(_Str, NULL, 10); } -DWORD XGetLanguage() -{ +DWORD XGetLanguage() +{ unsigned char ucLang = app.GetMinecraftLanguage(0); SceInt32 iLang; // check if we should override the system language or not - if(ucLang==MINECRAFT_LANGUAGE_DEFAULT) + if(ucLang==MINECRAFT_LANGUAGE_DEFAULT) { sceAppUtilSystemParamGetInt(SCE_SYSTEM_PARAM_ID_LANG,&iLang); } @@ -960,7 +960,7 @@ DWORD XGetLanguage() case SCE_SYSTEM_PARAM_LANG_ENGLISH_US : return XC_LANGUAGE_ENGLISH; case SCE_SYSTEM_PARAM_LANG_FRENCH : return XC_LANGUAGE_FRENCH; - case SCE_SYSTEM_PARAM_LANG_SPANISH : + case SCE_SYSTEM_PARAM_LANG_SPANISH : if(app.IsAmericanSKU()) { return XC_LANGUAGE_LATINAMERICANSPANISH; @@ -995,8 +995,8 @@ DWORD XGetLanguage() } } -DWORD XGetLocale() -{ +DWORD XGetLocale() +{ SceInt32 iLang; sceAppUtilSystemParamGetInt(SCE_SYSTEM_PARAM_ID_LANG,&iLang); switch(iLang) @@ -1005,7 +1005,7 @@ DWORD XGetLocale() case SCE_SYSTEM_PARAM_LANG_ENGLISH_US : return XC_LOCALE_UNITED_STATES; case SCE_SYSTEM_PARAM_LANG_FRENCH : return XC_LOCALE_FRANCE; - case SCE_SYSTEM_PARAM_LANG_SPANISH : + case SCE_SYSTEM_PARAM_LANG_SPANISH : if(app.IsAmericanSKU()) { return XC_LOCALE_LATIN_AMERICA; @@ -1039,7 +1039,7 @@ DWORD XGetLocale() } } -DWORD XEnableGuestSignin(BOOL fEnable) -{ - return 0; +DWORD XEnableGuestSignin(BOOL fEnable) +{ + return 0; } diff --git a/Minecraft.Client/PSVita/PSVitaExtras/libdivide.h b/Minecraft.Client/PSVita/PSVitaExtras/libdivide.h index 20103018..1bbe7067 100644 --- a/Minecraft.Client/PSVita/PSVitaExtras/libdivide.h +++ b/Minecraft.Client/PSVita/PSVitaExtras/libdivide.h @@ -29,8 +29,8 @@ #if ! LIBDIVIDE_HAS_STDINT_TYPES typedef __int32 int32_t; typedef unsigned __int32 uint32_t; -typedef __int64 int64_t; -typedef unsigned __int64 uint64_t; +typedef int64_t int64_t; +typedef uint64_t uint64_t; typedef __int8 int8_t; typedef unsigned __int8 uint8_t; #endif @@ -83,7 +83,7 @@ u32: [0-4] shift value [5] ignored [6] add indicator [7] shift path - + s32: [0-4] shift value [5] shift path [6] add indicator @@ -106,7 +106,7 @@ enum { LIBDIVIDE_U32_SHIFT_PATH = 0x80, LIBDIVIDE_U64_SHIFT_PATH = 0x80, LIBDIVIDE_S32_SHIFT_PATH = 0x20, - LIBDIVIDE_NEGATIVE_DIVISOR = 0x80 + LIBDIVIDE_NEGATIVE_DIVISOR = 0x80 }; @@ -123,7 +123,7 @@ struct libdivide_s32_t { struct libdivide_u64_t { uint64_t magic; uint8_t more; -}; +}; struct libdivide_s64_t { int64_t magic; @@ -146,7 +146,7 @@ LIBDIVIDE_API struct libdivide_s32_t libdivide_s32_gen(int32_t y); LIBDIVIDE_API struct libdivide_u32_t libdivide_u32_gen(uint32_t y); LIBDIVIDE_API struct libdivide_s64_t libdivide_s64_gen(int64_t y); LIBDIVIDE_API struct libdivide_u64_t libdivide_u64_gen(uint64_t y); - + LIBDIVIDE_API int32_t libdivide_s32_do(int32_t numer, const struct libdivide_s32_t *denom); LIBDIVIDE_API uint32_t libdivide_u32_do(uint32_t numer, const struct libdivide_u32_t *denom); LIBDIVIDE_API int64_t libdivide_s64_do(int64_t numer, const struct libdivide_s64_t *denom); @@ -156,19 +156,19 @@ LIBDIVIDE_API int libdivide_u32_get_algorithm(const struct libdivide_u32_t *deno LIBDIVIDE_API uint32_t libdivide_u32_do_alg0(uint32_t numer, const struct libdivide_u32_t *denom); LIBDIVIDE_API uint32_t libdivide_u32_do_alg1(uint32_t numer, const struct libdivide_u32_t *denom); LIBDIVIDE_API uint32_t libdivide_u32_do_alg2(uint32_t numer, const struct libdivide_u32_t *denom); - + LIBDIVIDE_API int libdivide_u64_get_algorithm(const struct libdivide_u64_t *denom); LIBDIVIDE_API uint64_t libdivide_u64_do_alg0(uint64_t numer, const struct libdivide_u64_t *denom); LIBDIVIDE_API uint64_t libdivide_u64_do_alg1(uint64_t numer, const struct libdivide_u64_t *denom); LIBDIVIDE_API uint64_t libdivide_u64_do_alg2(uint64_t numer, const struct libdivide_u64_t *denom); - + LIBDIVIDE_API int libdivide_s32_get_algorithm(const struct libdivide_s32_t *denom); LIBDIVIDE_API int32_t libdivide_s32_do_alg0(int32_t numer, const struct libdivide_s32_t *denom); LIBDIVIDE_API int32_t libdivide_s32_do_alg1(int32_t numer, const struct libdivide_s32_t *denom); LIBDIVIDE_API int32_t libdivide_s32_do_alg2(int32_t numer, const struct libdivide_s32_t *denom); LIBDIVIDE_API int32_t libdivide_s32_do_alg3(int32_t numer, const struct libdivide_s32_t *denom); LIBDIVIDE_API int32_t libdivide_s32_do_alg4(int32_t numer, const struct libdivide_s32_t *denom); - + LIBDIVIDE_API int libdivide_s64_get_algorithm(const struct libdivide_s64_t *denom); LIBDIVIDE_API int64_t libdivide_s64_do_alg0(int64_t numer, const struct libdivide_s64_t *denom); LIBDIVIDE_API int64_t libdivide_s64_do_alg1(int64_t numer, const struct libdivide_s64_t *denom); @@ -202,17 +202,17 @@ LIBDIVIDE_API __m128i libdivide_s64_do_vector_alg2(__m128i numers, const struct LIBDIVIDE_API __m128i libdivide_s64_do_vector_alg3(__m128i numers, const struct libdivide_s64_t * denom); LIBDIVIDE_API __m128i libdivide_s64_do_vector_alg4(__m128i numers, const struct libdivide_s64_t * denom); #endif - - - + + + //////// Internal Utility Functions - + static inline uint32_t libdivide__mullhi_u32(uint32_t x, uint32_t y) { uint64_t xl = x, yl = y; uint64_t rl = xl * yl; return (uint32_t)(rl >> 32); } - + static uint64_t libdivide__mullhi_u64(uint64_t x, uint64_t y) { #if HAS_INT128_T __uint128_t xl = x, yl = y; @@ -227,18 +227,18 @@ static uint64_t libdivide__mullhi_u64(uint64_t x, uint64_t y) { const uint64_t x0y1 = x0 * (uint64_t)y1; const uint64_t x1y0 = x1 * (uint64_t)y0; const uint64_t x1y1 = x1 * (uint64_t)y1; - + uint64_t temp = x1y0 + x0y0_hi; uint64_t temp_lo = temp & mask, temp_hi = temp >> 32; return x1y1 + temp_hi + ((temp_lo + x0y1) >> 32); #endif } - + static inline int64_t libdivide__mullhi_s64(int64_t x, int64_t y) { #if HAS_INT128_T __int128_t xl = x, yl = y; __int128_t rl = xl * yl; - return (int64_t)(rl >> 64); + return (int64_t)(rl >> 64); #else //full 128 bits are x0 * y0 + (x0 * y1 << 32) + (x1 * y0 << 32) + (x1 * y1 << 64) const uint32_t mask = 0xFFFFFFFF; @@ -250,7 +250,7 @@ static inline int64_t libdivide__mullhi_s64(int64_t x, int64_t y) { return x1*(int64_t)y1 + (t >> 32) + (w1 >> 32); #endif } - + #if LIBDIVIDE_USE_SSE2 static inline __m128i libdivide__u64_to_m128(uint64_t x) { @@ -275,7 +275,7 @@ static inline __m128i libdivide_get_FFFFFFFF00000000(void) { __m128i result = _mm_set1_epi8(-1); //optimizes to pcmpeqd on OS X return _mm_slli_epi64(result, 32); } - + static inline __m128i libdivide_get_00000000FFFFFFFF(void) { //returns the same as _mm_set1_epi64(0x00000000FFFFFFFFULL) without touching memory __m128i result = _mm_set1_epi8(-1); //optimizes to pcmpeqd on OS X @@ -288,7 +288,7 @@ static inline __m128i libdivide_get_0000FFFF(void) { __m128i result; //we don't care what its contents are result = _mm_cmpeq_epi8(result, result); //all 1s result = _mm_srli_epi32(result, 16); - return result; + return result; } static inline __m128i libdivide_s64_signbits(__m128i v) { @@ -302,7 +302,7 @@ static inline __m128i libdivide_s64_signbits(__m128i v) { static inline __m128i libdivide_u32_to_m128i(uint32_t amt) { return _mm_set_epi32(0, 0, 0, amt); } - + static inline __m128i libdivide_s64_shift_right_vector(__m128i v, int amt) { //implementation of _mm_sra_epi64. Here we have two 64 bit values which are shifted right to logically become (64 - amt) values, and are then sign extended from a (64 - amt) bit number. const int b = 64 - amt; @@ -320,7 +320,7 @@ static inline __m128i libdivide__mullhi_u32_flat_vector(__m128i a, __m128i b) { return _mm_or_si128(hi_product_0Z2Z, hi_product_Z1Z3); // = hi_product_0123 } - + /* Here, y is assumed to contain one 64 bit value repeated twice. */ static inline __m128i libdivide_mullhi_u64_flat_vector(__m128i x, __m128i y) { //full 128 bits are x0 * y0 + (x0 * y1 << 32) + (x1 * y0 << 32) + (x1 * y1 << 64) @@ -331,12 +331,12 @@ static inline __m128i libdivide_mullhi_u64_flat_vector(__m128i x, __m128i y) { const __m128i x0y1 = _mm_mul_epu32(x0, y1); const __m128i x1y0 = _mm_mul_epu32(x1, y0); const __m128i x1y1 = _mm_mul_epu32(x1, y1); - + const __m128i temp = _mm_add_epi64(x1y0, x0y0_hi); __m128i temp_lo = _mm_and_si128(temp, mask), temp_hi = _mm_srli_epi64(temp, 32); temp_lo = _mm_srli_epi64(_mm_add_epi64(temp_lo, x0y1), 32); temp_hi = _mm_add_epi64(x1y1, temp_hi); - + return _mm_add_epi64(temp_lo, temp_hi); } @@ -349,9 +349,9 @@ static inline __m128i libdivide_mullhi_s64_flat_vector(__m128i x, __m128i y) { p = _mm_sub_epi64(p, t2); return p; } - + #ifdef LIBDIVIDE_USE_SSE4_1 - + /* b is one 32 bit value repeated four times. */ static inline __m128i libdivide_mullhi_s32_flat_vector(__m128i a, __m128i b) { __m128i hi_product_0Z2Z = _mm_srli_epi64(_mm_mul_epi32(a, b), 32); @@ -359,7 +359,7 @@ static inline __m128i libdivide_mullhi_s32_flat_vector(__m128i a, __m128i b) { __m128i hi_product_Z1Z3 = _mm_and_si128(_mm_mul_epi32(a1X3X, b), libdivide_get_FFFFFFFF00000000()); return _mm_or_si128(hi_product_0Z2Z, hi_product_Z1Z3); // = hi_product_0123 } - + #else /* SSE2 does not have a signed multiplication instruction, but we can convert unsigned to signed pretty efficiently. Again, b is just a 32 bit value repeated four times. */ @@ -373,7 +373,7 @@ static inline __m128i libdivide_mullhi_s32_flat_vector(__m128i a, __m128i b) { } #endif #endif - + static inline int32_t libdivide__count_trailing_zeros32(uint32_t val) { #if __GNUC__ || __has_builtin(__builtin_ctz) /* Fast way to count trailing zeros */ @@ -389,7 +389,7 @@ static inline int32_t libdivide__count_trailing_zeros32(uint32_t val) { return result; #endif } - + static inline int32_t libdivide__count_trailing_zeros64(uint64_t val) { #if __LP64__ && (__GNUC__ || __has_builtin(__builtin_ctzll)) /* Fast way to count trailing zeros. Note that we disable this in 32 bit because gcc does something horrible - it calls through to a dynamically bound function. */ @@ -401,11 +401,11 @@ static inline int32_t libdivide__count_trailing_zeros64(uint64_t val) { return 32 + libdivide__count_trailing_zeros32((uint32_t)(val >> 32)); #endif } - + static inline int32_t libdivide__count_leading_zeros32(uint32_t val) { #if __GNUC__ || __has_builtin(__builtin_clzll) /* Fast way to count leading zeros */ - return __builtin_clz(val); + return __builtin_clz(val); #else /* Dorky way to count leading zeros. Note that this hangs for val = 0! */ int32_t result = 0; @@ -413,10 +413,10 @@ static inline int32_t libdivide__count_leading_zeros32(uint32_t val) { val <<= 1; result++; } - return result; + return result; #endif } - + static inline int32_t libdivide__count_leading_zeros64(uint64_t val) { #if __GNUC__ || __has_builtin(__builtin_clzll) /* Fast way to count leading zeros */ @@ -450,7 +450,7 @@ static uint32_t libdivide_64_div_32_to_32(uint32_t u1, uint32_t u0, uint32_t v, return result; } #endif - + #if LIBDIVIDE_IS_X86_64 && LIBDIVIDE_GCC_STYLE_ASM static uint64_t libdivide_128_div_64_to_64(uint64_t u1, uint64_t u0, uint64_t v, uint64_t *r) { //u0 -> rax @@ -465,10 +465,10 @@ static uint64_t libdivide_128_div_64_to_64(uint64_t u1, uint64_t u0, uint64_t v, } #else - + /* Code taken from Hacker's Delight, http://www.hackersdelight.org/HDcode/divlu.c . License permits inclusion here per http://www.hackersdelight.org/permissions.htm */ -static uint64_t libdivide_128_div_64_to_64(uint64_t u1, uint64_t u0, uint64_t v, uint64_t *r) { +static uint64_t libdivide_128_div_64_to_64(uint64_t u1, uint64_t u0, uint64_t v, uint64_t *r) { const uint64_t b = (1ULL << 32); // Number base (16 bits). uint64_t un1, un0, // Norm. dividend LSD's. vn1, vn0, // Norm. divisor digits. @@ -476,25 +476,25 @@ static uint64_t libdivide_128_div_64_to_64(uint64_t u1, uint64_t u0, uint64_t v, un64, un21, un10,// Dividend digit pairs. rhat; // A remainder. int s; // Shift amount for norm. - + if (u1 >= v) { // If overflow, set rem. if (r != NULL) // to an impossible value, *r = (uint64_t)(-1); // and return the largest return (uint64_t)(-1);} // possible quotient. - + /* count leading zeros */ s = libdivide__count_leading_zeros64(v); // 0 <= s <= 63. - + v = v << s; // Normalize divisor. vn1 = v >> 32; // Break divisor up into vn0 = v & 0xFFFFFFFF; // two 32-bit digits. - + un64 = (u1 << s) | ((u0 >> (64 - s)) & (-s >> 31)); un10 = u0 << s; // Shift dividend left. - + un1 = un10 >> 32; // Break right half of un0 = un10 & 0xFFFFFFFF; // dividend into two digits. - + q1 = un64/vn1; // Compute the first rhat = un64 - q1*vn1; // quotient digit, q1. again1: @@ -502,9 +502,9 @@ again1: q1 = q1 - 1; rhat = rhat + vn1; if (rhat < b) goto again1;} - + un21 = un64*b + un1 - q1*v; // Multiply and subtract. - + q0 = un21/vn1; // Compute the second rhat = un21 - q0*vn1; // quotient digit, q0. again2: @@ -512,21 +512,21 @@ again2: q0 = q0 - 1; rhat = rhat + vn1; if (rhat < b) goto again2;} - + if (r != NULL) // If remainder is wanted, *r = (un21*b + un0 - q0*v) >> s; // return it. return q1*b + q0; } #endif - + #if LIBDIVIDE_ASSERTIONS_ON #define LIBDIVIDE_ASSERT(x) do { if (! (x)) { fprintf(stderr, "Assertion failure on line %ld: %s\n", (long)__LINE__, #x); exit(-1); } } while (0) #else -#define LIBDIVIDE_ASSERT(x) +#define LIBDIVIDE_ASSERT(x) #endif - + #ifndef LIBDIVIDE_HEADER_ONLY - + ////////// UINT32 struct libdivide_u32_t libdivide_u32_gen(uint32_t d) { @@ -537,14 +537,14 @@ struct libdivide_u32_t libdivide_u32_gen(uint32_t d) { } else { const uint32_t floor_log_2_d = 31 - libdivide__count_leading_zeros32(d); - + uint8_t more; uint32_t rem, proposed_m; proposed_m = libdivide_64_div_32_to_32(1U << floor_log_2_d, 0, d, &rem); LIBDIVIDE_ASSERT(rem > 0 && rem < d); const uint32_t e = d - rem; - + /* This power works if e < 2**floor_log_2_d. */ if (e < (1U << floor_log_2_d)) { /* This power works */ @@ -560,7 +560,7 @@ struct libdivide_u32_t libdivide_u32_gen(uint32_t d) { result.magic = 1 + proposed_m; result.more = more; //result.more's shift should in general be ceil_log_2_d. But if we used the smaller power, we subtract one from the shift because we're using the smaller power. If we're using the larger power, we subtract one from the shift because it's taken care of by the add indicator. So floor_log_2_d happens to be correct in both cases. - + } return result; } @@ -582,23 +582,23 @@ uint32_t libdivide_u32_do(uint32_t numer, const struct libdivide_u32_t *denom) { } } - + int libdivide_u32_get_algorithm(const struct libdivide_u32_t *denom) { uint8_t more = denom->more; if (more & LIBDIVIDE_U32_SHIFT_PATH) return 0; else if (! (more & LIBDIVIDE_ADD_MARKER)) return 1; else return 2; } - + uint32_t libdivide_u32_do_alg0(uint32_t numer, const struct libdivide_u32_t *denom) { return numer >> (denom->more & LIBDIVIDE_32_SHIFT_MASK); } - + uint32_t libdivide_u32_do_alg1(uint32_t numer, const struct libdivide_u32_t *denom) { uint32_t q = libdivide__mullhi_u32(denom->magic, numer); return q >> denom->more; -} - +} + uint32_t libdivide_u32_do_alg2(uint32_t numer, const struct libdivide_u32_t *denom) { // denom->add != 0 uint32_t q = libdivide__mullhi_u32(denom->magic, numer); @@ -608,8 +608,8 @@ uint32_t libdivide_u32_do_alg2(uint32_t numer, const struct libdivide_u32_t *den - -#if LIBDIVIDE_USE_SSE2 + +#if LIBDIVIDE_USE_SSE2 __m128i libdivide_u32_do_vector(__m128i numers, const struct libdivide_u32_t *denom) { uint8_t more = denom->more; if (more & LIBDIVIDE_U32_SHIFT_PATH) { @@ -622,7 +622,7 @@ __m128i libdivide_u32_do_vector(__m128i numers, const struct libdivide_u32_t *de //return t >> denom->shift; __m128i t = _mm_add_epi32(_mm_srli_epi32(_mm_sub_epi32(numers, q), 1), q); return _mm_srl_epi32(t, libdivide_u32_to_m128i(more & LIBDIVIDE_32_SHIFT_MASK)); - + } else { //q >> denom->shift @@ -647,7 +647,7 @@ __m128i libdivide_u32_do_vector_alg2(__m128i numers, const struct libdivide_u32_ } #endif - + /////////// UINT64 struct libdivide_u64_t libdivide_u64_gen(uint64_t d) { @@ -658,14 +658,14 @@ struct libdivide_u64_t libdivide_u64_gen(uint64_t d) { } else { const uint32_t floor_log_2_d = 63 - libdivide__count_leading_zeros64(d); - + uint64_t proposed_m, rem; uint8_t more; proposed_m = libdivide_128_div_64_to_64(1ULL << floor_log_2_d, 0, d, &rem); //== (1 << (64 + floor_log_2_d)) / d LIBDIVIDE_ASSERT(rem > 0 && rem < d); const uint64_t e = d - rem; - + /* This power works if e < 2**floor_log_2_d. */ if (e < (1ULL << floor_log_2_d)) { /* This power works */ @@ -702,30 +702,30 @@ uint64_t libdivide_u64_do(uint64_t numer, const struct libdivide_u64_t *denom) { } } - + int libdivide_u64_get_algorithm(const struct libdivide_u64_t *denom) { uint8_t more = denom->more; if (more & LIBDIVIDE_U64_SHIFT_PATH) return 0; else if (! (more & LIBDIVIDE_ADD_MARKER)) return 1; else return 2; } - + uint64_t libdivide_u64_do_alg0(uint64_t numer, const struct libdivide_u64_t *denom) { - return numer >> (denom->more & LIBDIVIDE_64_SHIFT_MASK); + return numer >> (denom->more & LIBDIVIDE_64_SHIFT_MASK); } - + uint64_t libdivide_u64_do_alg1(uint64_t numer, const struct libdivide_u64_t *denom) { uint64_t q = libdivide__mullhi_u64(denom->magic, numer); return q >> denom->more; } - + uint64_t libdivide_u64_do_alg2(uint64_t numer, const struct libdivide_u64_t *denom) { uint64_t q = libdivide__mullhi_u64(denom->magic, numer); uint64_t t = ((numer - q) >> 1) + q; return t >> (denom->more & LIBDIVIDE_64_SHIFT_MASK); } - -#if LIBDIVIDE_USE_SSE2 + +#if LIBDIVIDE_USE_SSE2 __m128i libdivide_u64_do_vector(__m128i numers, const struct libdivide_u64_t * denom) { uint8_t more = denom->more; if (more & LIBDIVIDE_U64_SHIFT_PATH) { @@ -761,11 +761,11 @@ __m128i libdivide_u64_do_vector_alg2(__m128i numers, const struct libdivide_u64_ return _mm_srl_epi64(t, libdivide_u32_to_m128i(denom->more & LIBDIVIDE_64_SHIFT_MASK)); } - + #endif - + /////////// SINT32 - + static inline int32_t libdivide__mullhi_s32(int32_t x, int32_t y) { int64_t xl = x, yl = y; @@ -775,7 +775,7 @@ static inline int32_t libdivide__mullhi_s32(int32_t x, int32_t y) { struct libdivide_s32_t libdivide_s32_gen(int32_t d) { struct libdivide_s32_t result; - + /* If d is a power of 2, or negative a power of 2, we have to use a shift. This is especially important because the magic algorithm fails for -1. To check if d is a power of 2 or its inverse, it suffices to check whether its absolute value has exactly one bit set. This works even for INT_MIN, because abs(INT_MIN) == INT_MIN, and INT_MIN has one bit set and is a power of 2. */ uint32_t absD = (uint32_t)(d < 0 ? -d : d); //gcc optimizes this to the fast abs trick if ((absD & (absD - 1)) == 0) { //check if exactly one bit is set, don't care if absD is 0 since that's divide by zero @@ -784,14 +784,14 @@ struct libdivide_s32_t libdivide_s32_gen(int32_t d) { } else { const uint32_t floor_log_2_d = 31 - libdivide__count_leading_zeros32(absD); - LIBDIVIDE_ASSERT(floor_log_2_d >= 1); - + LIBDIVIDE_ASSERT(floor_log_2_d >= 1); + uint8_t more; //the dividend here is 2**(floor_log_2_d + 31), so the low 32 bit word is 0 and the high word is floor_log_2_d - 1 uint32_t rem, proposed_m; proposed_m = libdivide_64_div_32_to_32(1U << (floor_log_2_d - 1), 0, absD, &rem); const uint32_t e = absD - rem; - + /* We are going to start with a power of floor_log_2_d - 1. This works if works if e < 2**floor_log_2_d. */ if (e < (1U << floor_log_2_d)) { /* This power works */ @@ -807,7 +807,7 @@ struct libdivide_s32_t libdivide_s32_gen(int32_t d) { proposed_m += 1; result.magic = (d < 0 ? -(int32_t)proposed_m : (int32_t)proposed_m); result.more = more; - + } return result; } @@ -832,57 +832,57 @@ int32_t libdivide_s32_do(int32_t numer, const struct libdivide_s32_t *denom) { q += (q < 0); return q; } -} - +} + int libdivide_s32_get_algorithm(const struct libdivide_s32_t *denom) { uint8_t more = denom->more; int positiveDivisor = ! (more & LIBDIVIDE_NEGATIVE_DIVISOR); if (more & LIBDIVIDE_S32_SHIFT_PATH) return (positiveDivisor ? 0 : 1); - else if (more & LIBDIVIDE_ADD_MARKER) return (positiveDivisor ? 2 : 3); + else if (more & LIBDIVIDE_ADD_MARKER) return (positiveDivisor ? 2 : 3); else return 4; } - + int32_t libdivide_s32_do_alg0(int32_t numer, const struct libdivide_s32_t *denom) { uint8_t shifter = denom->more & LIBDIVIDE_32_SHIFT_MASK; int32_t q = numer + ((numer >> 31) & ((1 << shifter) - 1)); return q >> shifter; } - + int32_t libdivide_s32_do_alg1(int32_t numer, const struct libdivide_s32_t *denom) { uint8_t shifter = denom->more & LIBDIVIDE_32_SHIFT_MASK; int32_t q = numer + ((numer >> 31) & ((1 << shifter) - 1)); return - (q >> shifter); } - + int32_t libdivide_s32_do_alg2(int32_t numer, const struct libdivide_s32_t *denom) { int32_t q = libdivide__mullhi_s32(denom->magic, numer); q += numer; q >>= denom->more & LIBDIVIDE_32_SHIFT_MASK; - q += (q < 0); + q += (q < 0); return q; } - + int32_t libdivide_s32_do_alg3(int32_t numer, const struct libdivide_s32_t *denom) { int32_t q = libdivide__mullhi_s32(denom->magic, numer); q -= numer; q >>= denom->more & LIBDIVIDE_32_SHIFT_MASK; - q += (q < 0); + q += (q < 0); return q; } - + int32_t libdivide_s32_do_alg4(int32_t numer, const struct libdivide_s32_t *denom) { int32_t q = libdivide__mullhi_s32(denom->magic, numer); q >>= denom->more & LIBDIVIDE_32_SHIFT_MASK; - q += (q < 0); + q += (q < 0); return q; } -#if LIBDIVIDE_USE_SSE2 +#if LIBDIVIDE_USE_SSE2 __m128i libdivide_s32_do_vector(__m128i numers, const struct libdivide_s32_t * denom) { uint8_t more = denom->more; if (more & LIBDIVIDE_S32_SHIFT_PATH) { uint32_t shifter = more & LIBDIVIDE_32_SHIFT_MASK; - __m128i roundToZeroTweak = _mm_set1_epi32((1 << shifter) - 1); //could use _mm_srli_epi32 with an all -1 register + __m128i roundToZeroTweak = _mm_set1_epi32((1 << shifter) - 1); //could use _mm_srli_epi32 with an all -1 register __m128i q = _mm_add_epi32(numers, _mm_and_si128(_mm_srai_epi32(numers, 31), roundToZeroTweak)); //q = numer + ((numer >> 31) & roundToZeroTweak); q = _mm_sra_epi32(q, libdivide_u32_to_m128i(shifter)); // q = q >> shifter __m128i shiftMask = _mm_set1_epi32((int32_t)((int8_t)more >> 7)); //set all bits of shift mask = to the sign bit of more @@ -893,7 +893,7 @@ __m128i libdivide_s32_do_vector(__m128i numers, const struct libdivide_s32_t * d __m128i q = libdivide_mullhi_s32_flat_vector(numers, _mm_set1_epi32(denom->magic)); if (more & LIBDIVIDE_ADD_MARKER) { __m128i sign = _mm_set1_epi32((int32_t)(int8_t)more >> 7); //must be arithmetic shift - q = _mm_add_epi32(q, _mm_sub_epi32(_mm_xor_si128(numers, sign), sign)); // q += ((numer ^ sign) - sign); + q = _mm_add_epi32(q, _mm_sub_epi32(_mm_xor_si128(numers, sign), sign)); // q += ((numer ^ sign) - sign); } q = _mm_sra_epi32(q, libdivide_u32_to_m128i(more & LIBDIVIDE_32_SHIFT_MASK)); //q >>= shift q = _mm_add_epi32(q, _mm_srli_epi32(q, 31)); // q += (q < 0) @@ -919,7 +919,7 @@ __m128i libdivide_s32_do_vector_alg2(__m128i numers, const struct libdivide_s32_ __m128i q = libdivide_mullhi_s32_flat_vector(numers, _mm_set1_epi32(denom->magic)); q = _mm_add_epi32(q, numers); q = _mm_sra_epi32(q, libdivide_u32_to_m128i(denom->more & LIBDIVIDE_32_SHIFT_MASK)); - q = _mm_add_epi32(q, _mm_srli_epi32(q, 31)); + q = _mm_add_epi32(q, _mm_srli_epi32(q, 31)); return q; } @@ -927,7 +927,7 @@ __m128i libdivide_s32_do_vector_alg3(__m128i numers, const struct libdivide_s32_ __m128i q = libdivide_mullhi_s32_flat_vector(numers, _mm_set1_epi32(denom->magic)); q = _mm_sub_epi32(q, numers); q = _mm_sra_epi32(q, libdivide_u32_to_m128i(denom->more & LIBDIVIDE_32_SHIFT_MASK)); - q = _mm_add_epi32(q, _mm_srli_epi32(q, 31)); + q = _mm_add_epi32(q, _mm_srli_epi32(q, 31)); return q; } @@ -935,16 +935,16 @@ __m128i libdivide_s32_do_vector_alg4(__m128i numers, const struct libdivide_s32_ __m128i q = libdivide_mullhi_s32_flat_vector(numers, _mm_set1_epi32(denom->magic)); q = _mm_sra_epi32(q, libdivide_u32_to_m128i(denom->more)); //q >>= shift q = _mm_add_epi32(q, _mm_srli_epi32(q, 31)); // q += (q < 0) - return q; + return q; } #endif - + ///////////// SINT64 - + struct libdivide_s64_t libdivide_s64_gen(int64_t d) { struct libdivide_s64_t result; - + /* If d is a power of 2, or negative a power of 2, we have to use a shift. This is especially important because the magic algorithm fails for -1. To check if d is a power of 2 or its inverse, it suffices to check whether its absolute value has exactly one bit set. This works even for INT_MIN, because abs(INT_MIN) == INT_MIN, and INT_MIN has one bit set and is a power of 2. */ const uint64_t absD = (uint64_t)(d < 0 ? -d : d); //gcc optimizes this to the fast abs trick if ((absD & (absD - 1)) == 0) { //check if exactly one bit is set, don't care if absD is 0 since that's divide by zero @@ -952,14 +952,14 @@ struct libdivide_s64_t libdivide_s64_gen(int64_t d) { result.magic = 0; } else { - const uint32_t floor_log_2_d = 63 - libdivide__count_leading_zeros64(absD); - + const uint32_t floor_log_2_d = 63 - libdivide__count_leading_zeros64(absD); + //the dividend here is 2**(floor_log_2_d + 63), so the low 64 bit word is 0 and the high word is floor_log_2_d - 1 uint8_t more; uint64_t rem, proposed_m; proposed_m = libdivide_128_div_64_to_64(1ULL << (floor_log_2_d - 1), 0, absD, &rem); const uint64_t e = absD - rem; - + /* We are going to start with a power of floor_log_2_d - 1. This works if works if e < 2**floor_log_2_d. */ if (e < (1ULL << floor_log_2_d)) { /* This power works */ @@ -1000,9 +1000,9 @@ int64_t libdivide_s64_do(int64_t numer, const struct libdivide_s64_t *denom) { q += (q < 0); return q; } -} - - +} + + int libdivide_s64_get_algorithm(const struct libdivide_s64_t *denom) { uint8_t more = denom->more; int positiveDivisor = ! (more & LIBDIVIDE_NEGATIVE_DIVISOR); @@ -1010,20 +1010,20 @@ int libdivide_s64_get_algorithm(const struct libdivide_s64_t *denom) { else if (more & LIBDIVIDE_ADD_MARKER) return (positiveDivisor ? 2 : 3); else return 4; } - + int64_t libdivide_s64_do_alg0(int64_t numer, const struct libdivide_s64_t *denom) { uint32_t shifter = denom->more & LIBDIVIDE_64_SHIFT_MASK; int64_t q = numer + ((numer >> 63) & ((1LL << shifter) - 1)); - return q >> shifter; + return q >> shifter; } - + int64_t libdivide_s64_do_alg1(int64_t numer, const struct libdivide_s64_t *denom) { //denom->shifter != -1 && demo->shiftMask != 0 uint32_t shifter = denom->more & LIBDIVIDE_64_SHIFT_MASK; int64_t q = numer + ((numer >> 63) & ((1LL << shifter) - 1)); return - (q >> shifter); } - + int64_t libdivide_s64_do_alg2(int64_t numer, const struct libdivide_s64_t *denom) { int64_t q = libdivide__mullhi_s64(denom->magic, numer); q += numer; @@ -1031,20 +1031,20 @@ int64_t libdivide_s64_do_alg2(int64_t numer, const struct libdivide_s64_t *denom q += (q < 0); return q; } - + int64_t libdivide_s64_do_alg3(int64_t numer, const struct libdivide_s64_t *denom) { int64_t q = libdivide__mullhi_s64(denom->magic, numer); q -= numer; q >>= denom->more & LIBDIVIDE_64_SHIFT_MASK; - q += (q < 0); + q += (q < 0); return q; } - + int64_t libdivide_s64_do_alg4(int64_t numer, const struct libdivide_s64_t *denom) { int64_t q = libdivide__mullhi_s64(denom->magic, numer); q >>= denom->more; q += (q < 0); - return q; + return q; } @@ -1065,7 +1065,7 @@ __m128i libdivide_s64_do_vector(__m128i numers, const struct libdivide_s64_t * d __m128i q = libdivide_mullhi_s64_flat_vector(numers, libdivide__u64_to_m128(magic)); if (more & LIBDIVIDE_ADD_MARKER) { __m128i sign = _mm_set1_epi32((int32_t)((int8_t)more >> 7)); //must be arithmetic shift - q = _mm_add_epi64(q, _mm_sub_epi64(_mm_xor_si128(numers, sign), sign)); // q += ((numer ^ sign) - sign); + q = _mm_add_epi64(q, _mm_sub_epi64(_mm_xor_si128(numers, sign), sign)); // q += ((numer ^ sign) - sign); } q = libdivide_s64_shift_right_vector(q, more & LIBDIVIDE_64_SHIFT_MASK); //q >>= denom->mult_path.shift q = _mm_add_epi64(q, _mm_srli_epi64(q, 63)); // q += (q < 0) @@ -1102,20 +1102,20 @@ __m128i libdivide_s64_do_vector_alg3(__m128i numers, const struct libdivide_s64_ q = _mm_sub_epi64(q, numers); q = libdivide_s64_shift_right_vector(q, denom->more & LIBDIVIDE_64_SHIFT_MASK); q = _mm_add_epi64(q, _mm_srli_epi64(q, 63)); // q += (q < 0) - return q; + return q; } __m128i libdivide_s64_do_vector_alg4(__m128i numers, const struct libdivide_s64_t *denom) { __m128i q = libdivide_mullhi_s64_flat_vector(numers, libdivide__u64_to_m128(denom->magic)); q = libdivide_s64_shift_right_vector(q, denom->more); q = _mm_add_epi64(q, _mm_srli_epi64(q, 63)); - return q; + return q; } #endif - + /////////// C++ stuff - + #ifdef __cplusplus /* The C++ template design here is a total mess. This needs to be fixed by someone better at templates than I. The current design is: @@ -1131,7 +1131,7 @@ __m128i libdivide_s64_do_vector_alg4(__m128i numers, const struct libdivide_s64_ */ namespace libdivide_internal { - + #if LIBDIVIDE_USE_SSE2 #define MAYBE_VECTOR(x) x #define MAYBE_VECTOR_PARAM __m128i vector_func(__m128i, const DenomType *) @@ -1149,12 +1149,12 @@ namespace libdivide_internal { #endif template<typename IntType, typename DenomType, DenomType gen_func(IntType), int get_algo(const DenomType *), IntType do_func(IntType, const DenomType *), MAYBE_VECTOR_PARAM> - class divider_base { + class divider_base { public: DenomType denom; divider_base(IntType d) : denom(gen_func(d)) { } divider_base(const DenomType & d) : denom(d) { } - + IntType perform_divide(IntType val) const { return do_func(val, &denom); } #if LIBDIVIDE_USE_SSE2 __m128i perform_divide_vector(__m128i val) const { return vector_func(val, &denom); } @@ -1162,37 +1162,37 @@ namespace libdivide_internal { int get_algorithm() const { return get_algo(&denom); } }; - - + + template<class T> struct divider_mid { }; - + template<> struct divider_mid<uint32_t> { typedef uint32_t IntType; typedef struct libdivide_u32_t DenomType; template<IntType do_func(IntType, const DenomType *), MAYBE_VECTOR_PARAM> struct denom { typedef divider_base<IntType, DenomType, libdivide_u32_gen, libdivide_u32_get_algorithm, do_func, vector_func> divider; }; - + template<int ALGO, int J = 0> struct algo { }; template<int J> struct algo<-1, J> { typedef denom<libdivide_u32_do, MAYBE_VECTOR(libdivide_u32_do_vector)>::divider divider; }; template<int J> struct algo<0, J> { typedef denom<libdivide_u32_do_alg0, MAYBE_VECTOR(libdivide_u32_do_vector_alg0)>::divider divider; }; template<int J> struct algo<1, J> { typedef denom<libdivide_u32_do_alg1, MAYBE_VECTOR(libdivide_u32_do_vector_alg1)>::divider divider; }; template<int J> struct algo<2, J> { typedef denom<libdivide_u32_do_alg2, MAYBE_VECTOR(libdivide_u32_do_vector_alg2)>::divider divider; }; - - /* Define two more bogus ones so that the same (templated, presumably) code can handle both signed and unsigned */ + + /* Define two more bogus ones so that the same (templated, presumably) code can handle both signed and unsigned */ template<int J> struct algo<3, J> { typedef denom<crash_u32, MAYBE_VECTOR(crash_u32_vector)>::divider divider; }; template<int J> struct algo<4, J> { typedef denom<crash_u32, MAYBE_VECTOR(crash_u32_vector)>::divider divider; }; }; - + template<> struct divider_mid<int32_t> { typedef int32_t IntType; typedef struct libdivide_s32_t DenomType; template<IntType do_func(IntType, const DenomType *), MAYBE_VECTOR_PARAM> struct denom { typedef divider_base<IntType, DenomType, libdivide_s32_gen, libdivide_s32_get_algorithm, do_func, vector_func> divider; }; - - + + template<int ALGO, int J = 0> struct algo { }; template<int J> struct algo<-1, J> { typedef denom<libdivide_s32_do, MAYBE_VECTOR(libdivide_s32_do_vector)>::divider divider; }; template<int J> struct algo<0, J> { typedef denom<libdivide_s32_do_alg0, MAYBE_VECTOR(libdivide_s32_do_vector_alg0)>::divider divider; }; @@ -1200,36 +1200,36 @@ namespace libdivide_internal { template<int J> struct algo<2, J> { typedef denom<libdivide_s32_do_alg2, MAYBE_VECTOR(libdivide_s32_do_vector_alg2)>::divider divider; }; template<int J> struct algo<3, J> { typedef denom<libdivide_s32_do_alg3, MAYBE_VECTOR(libdivide_s32_do_vector_alg3)>::divider divider; }; template<int J> struct algo<4, J> { typedef denom<libdivide_s32_do_alg4, MAYBE_VECTOR(libdivide_s32_do_vector_alg4)>::divider divider; }; - + }; - + template<> struct divider_mid<uint64_t> { typedef uint64_t IntType; typedef struct libdivide_u64_t DenomType; template<IntType do_func(IntType, const DenomType *), MAYBE_VECTOR_PARAM> struct denom { typedef divider_base<IntType, DenomType, libdivide_u64_gen, libdivide_u64_get_algorithm, do_func, vector_func> divider; }; - + template<int ALGO, int J = 0> struct algo { }; template<int J> struct algo<-1, J> { typedef denom<libdivide_u64_do, MAYBE_VECTOR(libdivide_u64_do_vector)>::divider divider; }; template<int J> struct algo<0, J> { typedef denom<libdivide_u64_do_alg0, MAYBE_VECTOR(libdivide_u64_do_vector_alg0)>::divider divider; }; template<int J> struct algo<1, J> { typedef denom<libdivide_u64_do_alg1, MAYBE_VECTOR(libdivide_u64_do_vector_alg1)>::divider divider; }; template<int J> struct algo<2, J> { typedef denom<libdivide_u64_do_alg2, MAYBE_VECTOR(libdivide_u64_do_vector_alg2)>::divider divider; }; - + /* Define two more bogus ones so that the same (templated, presumably) code can handle both signed and unsigned */ template<int J> struct algo<3, J> { typedef denom<crash_u64, MAYBE_VECTOR(crash_u64_vector)>::divider divider; }; template<int J> struct algo<4, J> { typedef denom<crash_u64, MAYBE_VECTOR(crash_u64_vector)>::divider divider; }; }; - + template<> struct divider_mid<int64_t> { typedef int64_t IntType; typedef struct libdivide_s64_t DenomType; template<IntType do_func(IntType, const DenomType *), MAYBE_VECTOR_PARAM> struct denom { typedef divider_base<IntType, DenomType, libdivide_s64_gen, libdivide_s64_get_algorithm, do_func, vector_func> divider; }; - + template<int ALGO, int J = 0> struct algo { }; template<int J> struct algo<-1, J> { typedef denom<libdivide_s64_do, MAYBE_VECTOR(libdivide_s64_do_vector)>::divider divider; }; template<int J> struct algo<0, J> { typedef denom<libdivide_s64_do_alg0, MAYBE_VECTOR(libdivide_s64_do_vector_alg0)>::divider divider; }; @@ -1248,29 +1248,29 @@ class divider typename libdivide_internal::divider_mid<T>::template algo<ALGO>::divider sub; template<int NEW_ALGO, typename S> friend divider<S, NEW_ALGO> unswitch(const divider<S, -1> & d); divider(const typename libdivide_internal::divider_mid<T>::DenomType & denom) : sub(denom) { } - + public: - + /* Ordinary constructor, that takes the divisor as a parameter. */ divider(T n) : sub(n) { } - + /* Default constructor, that divides by 1 */ divider() : sub(1) { } - + /* Divides the parameter by the divisor, returning the quotient */ T perform_divide(T val) const { return sub.perform_divide(val); } - + #if LIBDIVIDE_USE_SSE2 /* Treats the vector as either two or four packed values (depending on the size), and divides each of them by the divisor, returning the packed quotients. */ - __m128i perform_divide_vector(__m128i val) const { return sub.perform_divide_vector(val); } + __m128i perform_divide_vector(__m128i val) const { return sub.perform_divide_vector(val); } #endif /* Returns the index of algorithm, for use in the unswitch function */ int get_algorithm() const { return sub.get_algorithm(); } // returns the algorithm for unswitching - + /* operator== */ bool operator==(const divider<T, ALGO> & him) const { return sub.denom.magic == him.sub.denom.magic && sub.denom.more == him.sub.denom.more; } - + bool operator!=(const divider<T, ALGO> & him) const { return ! (*this == him); } }; @@ -1291,10 +1291,10 @@ __m128i operator/(__m128i numer, const divider<int_type, ALGO> & denom) { return denom.perform_divide_vector(numer); } #endif - - + + #endif //__cplusplus - + #endif //LIBDIVIDE_HEADER_ONLY #ifdef __cplusplus } //close namespace libdivide diff --git a/Minecraft.Client/PSVita/PSVitaExtras/zconf.h b/Minecraft.Client/PSVita/PSVitaExtras/zconf.h index 48405ca0..981886db 100644 --- a/Minecraft.Client/PSVita/PSVitaExtras/zconf.h +++ b/Minecraft.Client/PSVita/PSVitaExtras/zconf.h @@ -485,7 +485,7 @@ typedef uLong FAR uLongf; # define z_off64_t off64_t #else # if defined(_WIN32) && !defined(__GNUC__) && !defined(Z_SOLO) -# define z_off64_t __int64 +# define z_off64_t int64_t # else # define z_off64_t z_off_t # endif diff --git a/Minecraft.Client/PSVita/PSVita_App.cpp b/Minecraft.Client/PSVita/PSVita_App.cpp index a21699c0..6cba116d 100644 --- a/Minecraft.Client/PSVita/PSVita_App.cpp +++ b/Minecraft.Client/PSVita/PSVita_App.cpp @@ -307,7 +307,7 @@ void CConsoleMinecraftApp::TemporaryCreateGameStart() wstring wWorldName = L"TestWorld"; bool isFlat = false; - __int64 seedValue = 0;//BiomeSource::findSeed(isFlat?LevelType::lvl_flat:LevelType::lvl_normal); // 4J - was (new Random())->nextLong() - now trying to actually find a seed to suit our requirements + int64_t seedValue = 0;//BiomeSource::findSeed(isFlat?LevelType::lvl_flat:LevelType::lvl_normal); // 4J - was (new Random())->nextLong() - now trying to actually find a seed to suit our requirements NetworkGameInitData *param = new NetworkGameInitData(); param->seed = seedValue; @@ -320,7 +320,7 @@ void CConsoleMinecraftApp::TemporaryCreateGameStart() app.SetGameHostOption(eGameHostOption_Gamertags,1); app.SetGameHostOption(eGameHostOption_BedrockFog,1); - app.SetGameHostOption(eGameHostOption_GameType,GameType::CREATIVE->getId()); + app.SetGameHostOption(eGameHostOption_GameType,GameType::CREATIVE->getId()); app.SetGameHostOption(eGameHostOption_LevelType, 0 ); app.SetGameHostOption(eGameHostOption_Structures, 1 ); app.SetGameHostOption(eGameHostOption_BonusChest, 0 ); @@ -391,7 +391,7 @@ void CConsoleMinecraftApp::CommerceTick() break; case eCommerce_State_GetProductList: - { + { m_eCommerce_State=eCommerce_State_GetProductList_Pending; SonyCommerce::CategoryInfo *pCategories=app.GetCategoryInfo(); std::list<SonyCommerce::CategoryInfoSub>::iterator iter = pCategories->subCategories.begin(); @@ -407,7 +407,7 @@ void CConsoleMinecraftApp::CommerceTick() break; case eCommerce_State_AddProductInfoDetailed: - { + { m_eCommerce_State=eCommerce_State_AddProductInfoDetailed_Pending; // for each of the products in the categories, get the detailed info. We really only need the long description and price info. @@ -444,7 +444,7 @@ void CConsoleMinecraftApp::CommerceTick() break; case eCommerce_State_RegisterDLC: - { + { m_eCommerce_State=eCommerce_State_Online; // register the DLC info SonyCommerce::CategoryInfo *pCategories=app.GetCategoryInfo(); @@ -531,20 +531,20 @@ SonyCommerce::CategoryInfo *CConsoleMinecraftApp::GetCategoryInfo() return &m_CategoryInfo; } -#endif +#endif void CConsoleMinecraftApp::ClearCommerceDetails() { #ifdef VITA_COMMERCE_ENABLED for(int i=0;i<m_ProductListCategoriesC;i++) { - std::vector<SonyCommerce::ProductInfo>* pProductList=&m_ProductListA[i]; + std::vector<SonyCommerce::ProductInfo>* pProductList=&m_ProductListA[i]; pProductList->clear(); } if(m_ProductListA!=NULL) { - delete [] m_ProductListA; + delete [] m_ProductListA; m_ProductListA=NULL; } @@ -580,11 +580,11 @@ void CConsoleMinecraftApp::GetDLCSkuIDFromProductList(char * pchDLCProductID, ch { SonyCommerce::ProductInfo Info=*it; if(strcmp(pchDLCProductID,Info.productId)==0) - { + { memcpy(pchSkuID,Info.skuId,SCE_NP_COMMERCE2_SKU_ID_LEN); return; } - } + } } } return; @@ -607,18 +607,18 @@ void CConsoleMinecraftApp::Checkout(char *pchSkuID) { SonyCommerce::ProductInfo Info=*it; if(strcmp(pchSkuID,Info.skuId)==0) - { + { productInfo = &(*it); break; } - } + } } } if(productInfo) { if(m_eCommerce_State==eCommerce_State_Online) - { + { strcpy(m_pchSkuID,productInfo->skuId); m_pCheckoutProductInfo = productInfo; m_eCommerce_State=eCommerce_State_Checkout; @@ -633,7 +633,7 @@ void CConsoleMinecraftApp::Checkout(char *pchSkuID) void CConsoleMinecraftApp::DownloadAlreadyPurchased(char *pchSkuID) { if(m_eCommerce_State==eCommerce_State_Online) - { + { strcpy(m_pchSkuID,pchSkuID); m_eCommerce_State=eCommerce_State_DownloadAlreadyPurchased; } @@ -642,7 +642,7 @@ void CConsoleMinecraftApp::DownloadAlreadyPurchased(char *pchSkuID) bool CConsoleMinecraftApp::UpgradeTrial() { if(m_eCommerce_State==eCommerce_State_Online) - { + { m_eCommerce_State=eCommerce_State_UpgradeTrial; return true; } @@ -687,7 +687,7 @@ bool CConsoleMinecraftApp::DLCAlreadyPurchased(char *pchTitle) { SonyCommerce::ProductInfo Info=*it; if(strcmp(pchTitle,Info.skuId)==0) - { + { if(Info.purchasabilityFlag==SCE_TOOLKIT_NP_COMMERCE_NOT_PURCHASED) { return false; @@ -697,7 +697,7 @@ bool CConsoleMinecraftApp::DLCAlreadyPurchased(char *pchTitle) return true; } } - } + } } } #endif //#ifdef VITA_COMMERCE_ENABLED @@ -734,7 +734,7 @@ void CConsoleMinecraftApp::CommerceGetCategoriesCallback(LPVOID lpParam,int err) if(err==0) { pClass->m_ProductListCategoriesC=pClass->m_CategoryInfo.countOfSubCategories; - // allocate the memory for the product info for each categories + // allocate the memory for the product info for each categories if(pClass->m_CategoryInfo.countOfSubCategories>0) { pClass->m_ProductListA = (std::vector<SonyCommerce::ProductInfo> *) new std::vector<SonyCommerce::ProductInfo> [pClass->m_CategoryInfo.countOfSubCategories]; @@ -768,7 +768,7 @@ void CConsoleMinecraftApp::CommerceGetProductListCallback(LPVOID lpParam,int err { // we're done, so now retrieve the additional product details for each product pClass->m_eCommerce_State=eCommerce_State_AddProductInfoDetailed; - pClass->m_bCommerceProductListRetrieved=true; + pClass->m_bCommerceProductListRetrieved=true; } else { @@ -778,21 +778,21 @@ void CConsoleMinecraftApp::CommerceGetProductListCallback(LPVOID lpParam,int err else { pClass->m_eCommerce_State=eCommerce_State_Error; - pClass->m_bCommerceProductListRetrieved=true; + pClass->m_bCommerceProductListRetrieved=true; } } // void CConsoleMinecraftApp::CommerceGetDetailedProductInfoCallback(LPVOID lpParam,int err) // { // CConsoleMinecraftApp *pScene=(CConsoleMinecraftApp *)lpParam; -// +// // if(err==0) // { // pScene->m_eCommerce_State=eCommerce_State_Idle; -// //pScene->m_bCommerceProductListRetrieved=true; +// //pScene->m_bCommerceProductListRetrieved=true; // } // //printf("Callback hit, error 0x%08x\n", err); -// +// // } void CConsoleMinecraftApp::CommerceAddDetailedProductInfoCallback(LPVOID lpParam,int err) @@ -812,7 +812,7 @@ void CConsoleMinecraftApp::CommerceAddDetailedProductInfoCallback(LPVOID lpParam { // MGH - change this to a while loop so we can skip empty categories. do - { + { pClass->m_iCurrentCategory++; }while(pClass->m_ProductListA[pClass->m_iCurrentCategory].size() == 0 && pClass->m_iCurrentCategory<pClass->m_ProductListCategoriesC); @@ -821,12 +821,12 @@ void CConsoleMinecraftApp::CommerceAddDetailedProductInfoCallback(LPVOID lpParam { // there are no more categories, so we're done pClass->m_eCommerce_State=eCommerce_State_RegisterDLC; - pClass->m_bProductListAdditionalDetailsRetrieved=true; + pClass->m_bProductListAdditionalDetailsRetrieved=true; } else { // continue with the next category - pClass->m_eCommerce_State=eCommerce_State_AddProductInfoDetailed; + pClass->m_eCommerce_State=eCommerce_State_AddProductInfoDetailed; } } else @@ -838,7 +838,7 @@ void CConsoleMinecraftApp::CommerceAddDetailedProductInfoCallback(LPVOID lpParam else { pClass->m_eCommerce_State=eCommerce_State_Error; - pClass->m_bProductListAdditionalDetailsRetrieved=true; + pClass->m_bProductListAdditionalDetailsRetrieved=true; pClass->m_iCurrentProduct=0; pClass->m_iCurrentCategory=0; } @@ -1109,7 +1109,7 @@ void printSaveState() case C4JStorage::ESaveGame_SaveCache: strState = "ESaveGame_SaveCache"; break; case C4JStorage::ESaveGame_ReconstructCache: strState = "ESaveGame_ReconstructCache"; break; } - + app.DebugPrintf("[printSaveState] GetSaveState == %s.\n", strState.c_str()); #endif } @@ -1156,7 +1156,7 @@ void CConsoleMinecraftApp::SaveDataTick() { app.DebugPrintf("[SaveDataTick] eSaveDataDeleteState_abort.\n"); StorageManager.CancelIncompleteOperation(); - } + } else if (m_bSaveDataDeleteDialogState == eSaveDataDeleteState_continue) { app.DebugPrintf("[SaveDataTick] eSaveDataDeleteState_continue.\n"); @@ -1228,7 +1228,7 @@ void CConsoleMinecraftApp::Callback_SaveGameIncomplete(void *pParam, C4JStorage: int CConsoleMinecraftApp::NoSaveSpaceReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - if(result==C4JStorage::EMessage_ResultAccept) + if(result==C4JStorage::EMessage_ResultAccept) { int blocksRequired = (int)pParam; if(blocksRequired > 0) @@ -1256,7 +1256,7 @@ int CConsoleMinecraftApp::cbConfirmDeleteMessageBox(void *pParam, int iPad, cons if (pClass != NULL && pClass->m_pSaveToDelete != NULL) { - if (result == C4JStorage::EMessage_ResultDecline) + if (result == C4JStorage::EMessage_ResultDecline) { pClass->m_bSaveDataDeleteDialogState = eSaveDataDeleteState_deleting; C4JStorage::ESaveGameState eDeleteStatus = StorageManager.DeleteSaveData(pClass->m_pSaveToDelete, cbSaveDataDeleted, pClass); @@ -1290,7 +1290,7 @@ void CConsoleMinecraftApp::initSaveIncompleteDialog(int spaceNeeded) param.sysMsgParam->sysMsgType = SCE_SAVEDATA_DIALOG_SYSMSG_TYPE_NOSPACE_CONTINUABLE; param.sysMsgParam->value = (SceInt32) spaceNeeded; - + SceInt32 ret = sceSaveDataDialogInit(¶m); if (ret == SCE_OK) { @@ -1376,13 +1376,13 @@ void CConsoleMinecraftApp::initSaveDataDeleteDialog() // Start getting saves data to use when deleting. if (StorageManager.ReturnSavesInfo() == NULL) { - C4JStorage::ESaveGameState eSGIStatus - = StorageManager.GetSavesInfo( + C4JStorage::ESaveGameState eSGIStatus + = StorageManager.GetSavesInfo( ProfileManager.GetPrimaryPad(), - NULL, - this, + NULL, + this, "save" - ); + ); } // Dim background because sony doesn't do that. @@ -1414,7 +1414,7 @@ void CConsoleMinecraftApp::updateSaveDataDeleteDialog() { SceSaveDataDialogResult dialogResult; ZeroMemory(&dialogResult, sizeof(SceSaveDataDialogResult)); - + SceInt32 ret = sceSaveDataDialogGetResult(&dialogResult); if (ret == SCE_OK) { @@ -1438,7 +1438,7 @@ void CConsoleMinecraftApp::updateSaveDataDeleteDialog() { SceAppUtilSaveDataSlotParam slotParam; ret = sceAppUtilSaveDataSlotGetParam( dialogResult.slotId, &slotParam, NULL ); - + if (ret == SCE_OK) { int saveindex = -1; @@ -1469,12 +1469,12 @@ void CConsoleMinecraftApp::updateSaveDataDeleteDialog() { app.DebugPrintf("[SaveDataDeleteDialog] ERROR: PERFORMING DELETE OPERATION, pSavesDetails is null.\n"); } - + if (pSaveInfo != NULL) { app.DebugPrintf( "[SaveDataDeleteDialog] User wishes to delete slot_%d:\n\t" - "4jsaveindex=%d, filename='%s', title='%s', subtitle='%s', size=%dKiB.\n", + "4jsaveindex=%d, filename='%s', title='%s', subtitle='%s', size=%dKiB.\n", dialogResult.slotId, saveindex, pSaveInfo->UTF8SaveFilename, @@ -1490,7 +1490,7 @@ void CConsoleMinecraftApp::updateSaveDataDeleteDialog() }; ui.RequestMessageBox( - IDS_TOOLTIPS_DELETESAVE, IDS_TEXT_DELETE_SAVE, + IDS_TOOLTIPS_DELETESAVE, IDS_TEXT_DELETE_SAVE, uiIDA, 2, 0, &cbConfirmDeleteMessageBox, this, @@ -1498,7 +1498,7 @@ void CConsoleMinecraftApp::updateSaveDataDeleteDialog() ); m_bSaveDataDeleteDialogState = eSaveDataDeleteState_userConfirmation; - + m_pSaveToDelete = pSaveInfo; } else @@ -1571,7 +1571,7 @@ void CConsoleMinecraftApp::getSaveDataDeleteDialogParam(SceSaveDataDialogParam * { SceAppUtilSaveDataSlotParam slotParam; int ret = sceAppUtilSaveDataSlotGetParam( i, &slotParam, NULL ); - + if (ret == SCE_OK) { SceAppUtilSaveDataSlot slot; @@ -1584,7 +1584,7 @@ void CConsoleMinecraftApp::getSaveDataDeleteDialogParam(SceSaveDataDialogParam * slots.push_back( slot ); } } - + SceAppUtilSaveDataSlot *pSavesList = new SceAppUtilSaveDataSlot[slots.size()]; int slotIndex = 0; @@ -1618,7 +1618,7 @@ void CConsoleMinecraftApp::getSaveDataDeleteDialogParam(SceSaveDataDialogParam * listParam.listTitle = (const SceChar8 *) strPtr; listParam.itemStyle = SCE_SAVEDATA_DIALOG_LIST_ITEM_STYLE_TITLE_SUBTITLE_DATE; - + baseParam->mode = SCE_SAVEDATA_DIALOG_MODE_LIST; baseParam->dispType = SCE_SAVEDATA_DIALOG_TYPE_DELETE; baseParam->listParam = &listParam; @@ -1659,10 +1659,10 @@ int CConsoleMinecraftApp::cbSaveDataDeleted( void *pParam, const bool success ) void CConsoleMinecraftApp::finishedDeletingSaves(bool bContinue) { app.DebugPrintf( "[finishedDeletingSaves] %s.\n", (bContinue?"Continuing":"Aborting") ); - + StorageManager.SetSaveDisabled(false); LeaveSaveNotificationSection(); - + StorageManager.ClearSaveError(); StorageManager.ClearOptionsSaveError(); |
