Skip to content

Commit

Permalink
Rainbomizer News: Re-enable in-game Rainbomizer news
Browse files Browse the repository at this point in the history
* Fixed for the latest version.
* Also a different server since the main one isn't redirected
  properly.
  • Loading branch information
Parik27 committed May 29, 2022
1 parent fb07fe0 commit 8759e85
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 23 deletions.
1 change: 1 addition & 0 deletions config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
[Randomizers]

RainbomizerCredits = true
RainbomizerNews = true

CarGeneratorRandomizer = true
ClothesRandomizer = true
Expand Down
2 changes: 1 addition & 1 deletion src/common/configDefault.hh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const char configDefault[] = R"(
[Randomizers]
RainbomizerCredits = true
RainbomizerNews = true
CarGeneratorRandomizer = true
ClothesRandomizer = true
Expand All @@ -38,7 +39,6 @@ ScriptVehicleRandomizer = true
VoiceLineRandomizer = true
SfxRandomizer = true
TimecycleRandomizer = true
MissionRandomizer = true
PedRandomizer = true
HandlingRandomizer = false
SwitchSceneRandomizer = false
Expand Down
4 changes: 2 additions & 2 deletions src/common/logger.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
#ifndef NDEBUG
#define RAINBOMIZER_BUILD "Debug Build: " __DATE__ " " __TIME__
#else
#define RAINBOMIZER_BUILD "Release v3.2: " __DATE__ " " __TIME__
#define RAINBOMIZER_BUILD_SHORT "Release v3.2"
#define RAINBOMIZER_BUILD "Release v3.3: " __DATE__ " " __TIME__
#define RAINBOMIZER_BUILD_SHORT "Release v3.3"
#endif

constexpr int RAINBOMIZER_BUILD_NUMBER =
Expand Down
29 changes: 9 additions & 20 deletions src/misc/news.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <common/config.hh>

#include "Patterns/Patterns.hh"
#include "Utils.hh"

#include "common/logger.hh"
Expand All @@ -25,38 +26,26 @@ class NewsRandomizer
if (strstr (prefix, "/news/"))
{
buff = out;
strncpy (buff, "news.rainbomizer.com", outLen);
strncpy (buff, "news.parik.eu.org/3.3", outLen);
}
}

return buff;
}

/*******************************************************/
template <auto &rage__formatf>
static void
MoveCloudCache (char *out, int len, char *format, char *, char *file)
{
static std::string s_CachePath
= Rainbomizer::Common::GetRainbomizerFileName ("", "cloudcache/");
rage__formatf (out, len, format, s_CachePath.c_str (), file);
}

public:
NewsRandomizer ()
{
if (!ConfigManager::ReadConfig ("RainbomizerNews"))
return;

char *cloudPath = hook::get_pattern<char> (
"63 6c 6f 75 64 5f 25 30 31 36 49 36 34 78 2e 64 61 74 00");

if (cloudPath)
strcpy (cloudPath, "rbcld_%016I64x.dat");

REGISTER_HOOK ("41 b8 80 00 00 00 ? 8b ce e8 ? ? ? ? ? 8b f8 ", 9,
SetRainbowDomain, char *, char *, char *, uint32_t);

REGISTER_HOOK (
"0f 44 ca 41 8b d0 ? 8d 05 ? ? ? ? e8 ? ? ? ? ? 83 c4 38 c3 ", 13,
MoveCloudCache, void, char *, int, char *, const char *, char *);
}
}
#ifdef BUILD_NEWS_RANDOMIZER
news
#endif
;
} news;

0 comments on commit 8759e85

Please sign in to comment.