Commit 83268eb2 authored by fallenstardust's avatar fallenstardust

update bufferio_android.h

parent f7cd7af5
......@@ -1396,7 +1396,7 @@ void Game::MainLoop() {
}
#endif
while(device->run()) {
ALOGV("game draw frame");
//ALOGV("game draw frame");
linePatternD3D = (linePatternD3D + 1) % 30;
linePatternGL = (linePatternGL << 1) | (linePatternGL >> 15);
atkframe += 0.1f;
......
......@@ -7,21 +7,19 @@
class BufferIO {
public:
inline static int ReadInt32(unsigned char*& p) {
int ret;
memcpy(&ret, (void *)p, sizeof(int));
int ret = *(int*)p;
p += 4;
return ret;
}
inline static short ReadInt16(unsigned char*& p) {
short ret;
memcpy(&ret, (void *)p, sizeof(short));
short ret = *(short*)p;
p += 2;
return ret;
}
inline static char ReadInt8(unsigned char*& p) {
char* pRet = (char*)p;
char ret = *(char*)p;
p++;
return *pRet;
return ret;
}
inline static unsigned char ReadUInt8(unsigned char*& p) {
unsigned char ret = *(unsigned char*)p;
......@@ -29,15 +27,15 @@ public:
return ret;
}
inline static void WriteInt32(unsigned char*& p, int val) {
memcpy((void *)p, &val, sizeof(int));
(*(int*)p) = val;
p += 4;
}
inline static void WriteInt16(unsigned char*& p, short val) {
memcpy((void *)p, &val, sizeof(short));
(*(short*)p) = val;
p += 2;
}
inline static void WriteInt8(unsigned char*& p, char val) {
memcpy((void *)p, &val, sizeof(char));
*p = val;
p++;
}
template<typename T1, typename T2>
......@@ -61,6 +59,7 @@ public:
*pstr = 0;
return l;
}
// UTF-16/UTF-32 to UTF-8
static int EncodeUTF8(const wchar_t * wsrc, char * str) {
char* pstr = str;
while(*wsrc != 0) {
......@@ -71,17 +70,24 @@ public:
str[0] = ((*wsrc >> 6) & 0x1f) | 0xc0;
str[1] = ((*wsrc) & 0x3f) | 0x80;
str += 2;
} else {
} else if(*wsrc < 0x10000 && (*wsrc < 0xd800 || *wsrc > 0xdfff)) {
str[0] = ((*wsrc >> 12) & 0xf) | 0xe0;
str[1] = ((*wsrc >> 6) & 0x3f) | 0x80;
str[2] = ((*wsrc) & 0x3f) | 0x80;
str += 3;
} else {
str[0] = ((*wsrc >> 18) & 0x7) | 0xf0;
str[1] = ((*wsrc >> 12) & 0x3f) | 0x80;
str[2] = ((*wsrc >> 6) & 0x3f) | 0x80;
str[3] = ((*wsrc) & 0x3f) | 0x80;
str += 4;
}
wsrc++;
}
*str = 0;
return str - pstr;
}
// UTF-8 to UTF-16/UTF-32
static int DecodeUTF8(const char * src, wchar_t * wstr) {
const char* p = src;
wchar_t* wp = wstr;
......@@ -90,13 +96,13 @@ public:
*wp = *p;
p++;
} else if((*p & 0xe0) == 0xc0) {
*wp = (((int)p[0] & 0x1f) << 6) | ((int)p[1] & 0x3f);
*wp = (((unsigned)p[0] & 0x1f) << 6) | ((unsigned)p[1] & 0x3f);
p += 2;
} else if((*p & 0xf0) == 0xe0) {
*wp = (((int)p[0] & 0xf) << 12) | (((int)p[1] & 0x3f) << 6) | ((int)p[2] & 0x3f);
*wp = (((unsigned)p[0] & 0xf) << 12) | (((unsigned)p[1] & 0x3f) << 6) | ((unsigned)p[2] & 0x3f);
p += 3;
} else if((*p & 0xf8) == 0xf0) {
*wp = (((int)p[0] & 0x7) << 18) | (((int)p[1] & 0x3f) << 12) | (((int)p[2] & 0x3f) << 6) | ((int)p[3] & 0x3f);
*wp = (((unsigned)p[0] & 0x7) << 18) | (((unsigned)p[1] & 0x3f) << 12) | (((unsigned)p[2] & 0x3f) << 6) | ((unsigned)p[3] & 0x3f);
p += 4;
} else
p++;
......
#[2024.1][2024.1 TCG][2023.10][2023.7][2023.4][2023.1][2022.10][2022.7][2022.4][2022.1][2021.10][2021.7][2021.4][2021.1][2020.10][2020.7][2020.4][2020.1][2019.10][2019.7][2019.4][2019.1][2018.10][2018.7][2018.4][2018.1][2017.10][2017.7][2017.4][2017.1][2016.10][2016.7][2016.4][2016.1][2015.10][2015.4][2015.1][2014.10][2014.7][2014.4][2014.2][2013.9][2023.9 TCG][2023.6 TCG][2023.2 TCG][2022.12 TCG][2022.10 TCG][2022.5 TCG][2022.2 TCG][2021.10 TCG][2021.7 TCG][2021.3 TCG][2020.12 TCG][2020.9 TCG][2020.6 TCG][2020.4 TCG][2020.1 TCG][2019.10 TCG][2019.7 TCG][2019.4 TCG][2019.1 TCG][2018.12 TCG][2018.9 TCG][2018.5 TCG][2018.2 TCG][2017.11 TCG][2017.9 TCG][2017.6 TCG][2017.3 TCG][2016.8 TCG][2016.4 TCG][2015.11 TCG][2015.7 TCG][2015.4 TCG][2015.1 TCG][2014.10 TCG][2014.7 TCG][2014.4 TCG][2014.1.1 TCG][2013.10.11 TCG][2013.3.1][2012.9.1][2012.3.1][2011.9.1]
!2024.1
#forbidden
91869203 0 --アマゾネスの射手
......@@ -344,7 +343,7 @@
65536818 1 --Denglong, First of the Yang Zing
94677445 1 --Ib the World Chalice Justiciar
74586817 1 --PSY-Framelord Omega
39880350 1 --Sunavalon Dryas
93896655 1 --Sunavalon Dryas
65563871 1 --Sunvine Healer
90953320 1 --T.G. Hyper Librarian
27552504 1 --Beatrice, Lady of the Eternal
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment