mirror of
https://github.com/libretro/ppsspp.git
synced 2024-11-28 02:41:18 +00:00
Merge branch 'master' of github.com:hrydgard/native
Conflicts: base/stringutil.h
This commit is contained in:
commit
c82e19a91e
41
base/stringutil.cpp
Normal file
41
base/stringutil.cpp
Normal file
@ -0,0 +1,41 @@
|
||||
#include <string.h>
|
||||
#include "base/stringutil.h"
|
||||
|
||||
unsigned int parseHex(const char *_szValue)
|
||||
{
|
||||
DWORD Count, Value = 0;
|
||||
size_t Finish = strlen(_szValue);
|
||||
if (Finish > 8 ) { Finish = 8; }
|
||||
|
||||
for (Count = 0; Count < Finish; Count++) {
|
||||
Value = (Value << 4);
|
||||
switch( _szValue[Count] ) {
|
||||
case '0': break;
|
||||
case '1': Value += 1; break;
|
||||
case '2': Value += 2; break;
|
||||
case '3': Value += 3; break;
|
||||
case '4': Value += 4; break;
|
||||
case '5': Value += 5; break;
|
||||
case '6': Value += 6; break;
|
||||
case '7': Value += 7; break;
|
||||
case '8': Value += 8; break;
|
||||
case '9': Value += 9; break;
|
||||
case 'A': Value += 10; break;
|
||||
case 'a': Value += 10; break;
|
||||
case 'B': Value += 11; break;
|
||||
case 'b': Value += 11; break;
|
||||
case 'C': Value += 12; break;
|
||||
case 'c': Value += 12; break;
|
||||
case 'D': Value += 13; break;
|
||||
case 'd': Value += 13; break;
|
||||
case 'E': Value += 14; break;
|
||||
case 'e': Value += 14; break;
|
||||
case 'F': Value += 15; break;
|
||||
case 'f': Value += 15; break;
|
||||
default:
|
||||
Value = (Value >> 4);
|
||||
Count = Finish;
|
||||
}
|
||||
}
|
||||
return Value;
|
||||
}
|
@ -19,3 +19,6 @@ public:
|
||||
inline bool endsWith(const std::string &str, const std::string &what) {
|
||||
return str.substr(str.size() - what.size()) == what;
|
||||
}
|
||||
|
||||
// highly unsafe and not recommended.
|
||||
unsigned int parseHex(const char* _szValue);
|
||||
|
35
base/threadutil.cpp
Normal file
35
base/threadutil.cpp
Normal file
@ -0,0 +1,35 @@
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#include "base/threadutil.h"
|
||||
|
||||
void setCurrentThreadName(const char* szThreadName)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
static const DWORD MS_VC_EXCEPTION = 0x406D1388;
|
||||
|
||||
#pragma pack(push,8)
|
||||
struct THREADNAME_INFO
|
||||
{
|
||||
DWORD dwType; // must be 0x1000
|
||||
LPCSTR szName; // pointer to name (in user addr space)
|
||||
DWORD dwThreadID; // thread ID (-1=caller thread)
|
||||
DWORD dwFlags; // reserved for future use, must be zero
|
||||
} info;
|
||||
#pragma pack(pop)
|
||||
|
||||
info.dwType = 0x1000;
|
||||
info.szName = szThreadName;
|
||||
info.dwThreadID = -1; //dwThreadID;
|
||||
info.dwFlags = 0;
|
||||
|
||||
__try
|
||||
{
|
||||
RaiseException(MS_VC_EXCEPTION, 0, sizeof(info)/sizeof(ULONG_PTR), (ULONG_PTR*)&info);
|
||||
}
|
||||
__except(EXCEPTION_CONTINUE_EXECUTION)
|
||||
{}
|
||||
#else
|
||||
// Do nothing
|
||||
#endif
|
||||
}
|
3
base/threadutil.h
Normal file
3
base/threadutil.h
Normal file
@ -0,0 +1,3 @@
|
||||
#pragma once
|
||||
|
||||
void setCurrentThreadName(const char *name);
|
@ -48,7 +48,7 @@ GLSLProgram *glsl_create(const char *vshader, const char *fshader) {
|
||||
program->program_ = 0;
|
||||
program->vsh_ = 0;
|
||||
program->fsh_ = 0;
|
||||
strcpy(program->name, vshader + strlen(vshader) - 16);
|
||||
strcpy(program->name, vshader + strlen(vshader) - 15);
|
||||
strcpy(program->vshader_filename, vshader);
|
||||
strcpy(program->fshader_filename, fshader);
|
||||
if (glsl_recompile(program)) {
|
||||
@ -82,10 +82,15 @@ void glsl_refresh() {
|
||||
|
||||
bool glsl_recompile(GLSLProgram *program) {
|
||||
struct stat vs, fs;
|
||||
stat(program->vshader_filename, &vs);
|
||||
stat(program->fshader_filename, &fs);
|
||||
program->vshader_mtime = vs.st_mtime;
|
||||
program->fshader_mtime = fs.st_mtime;
|
||||
if (0 == stat(program->vshader_filename, &vs))
|
||||
program->vshader_mtime = vs.st_mtime;
|
||||
else
|
||||
program->vshader_mtime = 0;
|
||||
|
||||
if (0 == stat(program->fshader_filename, &fs))
|
||||
program->fshader_mtime = fs.st_mtime;
|
||||
else
|
||||
program->fshader_mtime = 0;
|
||||
|
||||
size_t sz;
|
||||
char *vsh_src = (char *)VFSReadFile(program->vshader_filename, &sz);
|
||||
|
@ -5,6 +5,11 @@
|
||||
#include "math/lin/vec3.h"
|
||||
#include "math/lin/quat.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#undef far
|
||||
#undef near
|
||||
#endif
|
||||
|
||||
// See http://code.google.com/p/oolongengine/source/browse/trunk/Oolong+Engine2/Math/neonmath/neon_matrix_impl.cpp?spec=svn143&r=143 when we need speed
|
||||
// no wait. http://code.google.com/p/math-neon/
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user