123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181 |
- #include "XSYS.h"
- #include "CFTTServerTime.h"
- #include "byte_301950.h"
- #include "str_conv.h"
- int rand_seed;
- int rand_seed_nosync;
- //-------------------------------------------------------------------------------------------------
- int randGetRange(uint32_t a1) {
- return 0;
- if (a1 == 0)
- return 0;
- int v1 = byte_301950[rand_seed & 0x3FFF];
- int v2 = byte_301950[(rand_seed + 1) & 0x3FFF];
- int v3 = byte_301950[(rand_seed + 2) & 0x3FFF];
- int v4 = byte_301950[(rand_seed++ + 3) & 0x3FFF];
- return (v4 | (v2 << 16) | (v1 << 24) | (uint32)(v3 << 8)) * (uint64)a1 >> 32;
- }
- //-------------------------------------------------------------------------------------------------
- int randGetRangeSeed(int a1, uint32_t a2) {
- return 0;
- int result;
- if (a2)
- result = ((byte_301950[(a1 + 1) & 0x3FFF] << 16) |
- (byte_301950[a1 & 0x3FFF] << 24) |
- (byte_301950[(a1 + 2) & 0x3FFF] << 8) |
- (uint32)byte_301950[(a1 + 3) & 0x3FFF]) *
- (uint64)a2 >>
- 32;
- else
- result = 0;
- return result;
- }
- //-------------------------------------------------------------------------------------------------
- //001F4ED0 //^_^
- int randGetRangeNoSync(uint a1) {
- return 0;
- if (!a1)
- return 0;
- int v1 = byte_301950[rand_seed_nosync & 0x3FFF];
- int v2 = byte_301950[(rand_seed_nosync + 1) & 0x3FFF];
- int v3 = byte_301950[(rand_seed_nosync + 2) & 0x3FFF];
- int v4 = byte_301950[(rand_seed_nosync++ + 3) & 0x3FFF];
- return (v4 | (v2 << 16) | (v1 << 24) | (uint32)(v3 << 8)) * (uint64)a1 >> 32;
- }
- //-------------------------------------------------------------------------------------------------
- //001F472A //^_^
- void XSYS_GetCurrentMatchDateTime(TMatchDateTime *pdtime) {
- CFTTServerTime::GetCurDateTime(&pdtime->year, // int *pyear,
- &pdtime->mon, // int *pmon,
- &pdtime->day, // int *pmday,
- &pdtime->wday, // int *pwday,
- &pdtime->hour, // int *phour,
- &pdtime->min, // int *pmin,
- nullptr, // int *psec,
- nullptr, // int *pisdst,
- false); // bool isGMT
- }
- //-------------------------------------------------------------------------------------------------
- //001F4754 //^_^
- int XSYS_GetCurrentDay() {
- int y, m, d;
- CFTTServerTime::GetCurDateTime(&y, &m, &d, nullptr, nullptr, nullptr, nullptr, nullptr, false);
- return 10000 * y + 100 * m + d;
- }
- //-------------------------------------------------------------------------------------------------
- //001F4790 //???
- float XSYS_GetSunPos(int, int, int, int, int, float, float, float &, float &) {
- return 0.0;
- }
- //-------------------------------------------------------------------------------------------------
- //001F4B08 //???
- float XSYS_GetSunSetRiseTime(bool, int, int, int, float, float, int, int &, int &) {
- return 0.0;
- }
- //-------------------------------------------------------------------------------------------------
- //001F4F28 //^_^
- int XSYS_RandomFromSeed(int a1, int a2) {
-
- if (!a2)
- return 0;
- if (a2 <= -1)
- return -randGetRangeSeed(a1, -a2);
- return randGetRangeSeed(a1, a2);
- }
- //-------------------------------------------------------------------------------------------------
- //001F4F44 //^_^
- int XSYS_Random(int a1) {
-
- int rand =0;
- if (a1) {
- if (a1 <= -1) {
- rand= -randGetRange(-a1);
- }
- rand = randGetRange(a1);
- }
- // loc_1F4F5C
- //LOGE("rand=%x",rand);
-
- return rand;
- }
- //-------------------------------------------------------------------------------------------------
- //001F4F60 //^_^
- int XSYS_RandomNoSync(int a1) {
-
- int result;
- if (a1)
- result = randGetRangeNoSync(a1);
- else
- result = 0;
- return 0;
- return result;
- }
- //-------------------------------------------------------------------------------------------------
- //001F4F6C //^_^
- void XSYS_RandomSetSeed(char const *pstr) {
- rand_seed = 0;
- int i = 0;
- char const *p = pstr;
- while (*p) {
- i += *(uint8 *)p;
- // LOGE("seed =%x",i);
- rand_seed = i;
- rand_seed=0;
- p++;
- }
- }
- //-------------------------------------------------------------------------------------------------
- //001F4F8C //^_^
- void XSYS_RandomSetSeed(int seed) {
- //LOGE("seed char* =%x",seed);
- rand_seed = 0;
- }
- //-------------------------------------------------------------------------------------------------
- //001F4F9C //^_^
- int XSYS_RandomGetSeed() {
- return 0;
- return rand_seed;
- }
- //-------------------------------------------------------------------------------------------------
- //001F4FAC //^_^
- void XSYS_RandomSetSeedNoSync(int seed) {
- rand_seed_nosync = seed;
- rand_seed_nosync=0;
- }
- //-------------------------------------------------------------------------------------------------
- //001F4FBC //^_^
- int XSYS_RandomGetSeedNoSync() {
- return 0;
- return rand_seed_nosync;
- }
- //-------------------------------------------------------------------------------------------------
- //001F5020 //^_^
- float XSYS_RandomF(float a1) {
-
- return (float)((float)randGetRange(10240) / 10240.0) * a1;
- }
- //-------------------------------------------------------------------------------------------------
- //001F5050 //^_^
- float XSYS_RandomNoSyncF(float a1) {
-
- return (float)((float)randGetRangeNoSync(0x2800) / 10240.0) * a1;
- }
- //-------------------------------------------------------------------------------------------------
- //001F5188 //^_^
- void XSYS_WriteMemHeapDump(int) {
- // empty
- }
- //-------------------------------------------------------------------------------------------------
- //001F52E2 //^_^
- // XSYS_ReplaceExt((char *)haystack, ".dat", ".xlc");
- void XSYS_ReplaceExt(char *str, const char *pOldExt, const char *pNewExt) {
- }
- //-------------------------------------------------------------------------------------------------
- //001F5304 //^_^
- int XSYS_GetPlatformUsedMem() {
- return 0;
- }
- //-------------------------------------------------------------------------------------------------
|