It compiles and runs for MSVC 2019!

The year is 2023. Incredible.
This commit is contained in:
Catastrophe573 2023-03-19 01:14:04 -04:00
parent 058411fa15
commit f3b22b655d
9 changed files with 31 additions and 42 deletions

4
.gitignore vendored
View File

@ -19,3 +19,7 @@ src/DMX_Remake/.vs/DMX_Remake/v16/Browse.VC.db-wal
src/DMX_Remake/.vs/DMX_Remake/v16/Browse.VC.opendb
src/DMX_Remake/.vs/DMX_Remake/v16/Browse.VC.db
src/DMX_Remake/.vs/DMX_Remake/v16/Browse.VC.db
src/DMX_Remake/DMX_Remake/Debug/DMX_Debug.exe.recipe
src/DMX_Remake/DMX_Remake/Release/DMX.exe.recipe
src/DMX_Remake/DMX_Remake/Release/DMX_Remake.vcxproj.FileListAbsolute.txt
src/DMX_Remake/DMX_Remake/Debug/DMX_Remake.vcxproj.FileListAbsolute.txt

Binary file not shown.

View File

@ -21,13 +21,15 @@
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
<PreferredToolArchitecture>x86</PreferredToolArchitecture>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<WholeProgramOptimization>false</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
<PreferredToolArchitecture>x86</PreferredToolArchitecture>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
@ -111,7 +113,10 @@
<UndefinePreprocessorDefinitions>
</UndefinePreprocessorDefinitions>
<UseStandardPreprocessor>false</UseStandardPreprocessor>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<WholeProgramOptimization>false</WholeProgramOptimization>
<DebugInformationFormat>None</DebugInformationFormat>
<SupportJustMyCode>true</SupportJustMyCode>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
@ -121,6 +126,7 @@
<SubSystem>Windows</SubSystem>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<IgnoreSpecificDefaultLibraries>libcmt.lib</IgnoreSpecificDefaultLibraries>
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
</Link>
<PreBuildEvent>
<Command>del $(ProjectDir)\release\versionManager.obj</Command>

View File

@ -170,10 +170,10 @@
<ClCompile Include="..\..\source\ppp_read.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\source\analyticsManager.cpp">
<ClCompile Include="..\..\source\versionManager.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\source\versionManager.cpp">
<ClCompile Include="..\..\source\analyticsManager.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>

Binary file not shown.

Binary file not shown.

View File

@ -1,26 +1,23 @@
// analyticsManager.cpp implements online usage tracking for Dance Maniax
// source file created by Allen Seitz 5/30/2016
// v1 - implements Google Analytics
// v2 - both analytics service has ve shut down in the last 10 years, so do nothing
#include "../headers/analyticsManager.h"
#include "../headers/versionManager.h"
#include "curl.h"
extern VersionManager version;
#define CLIENT_ID_FILENAME "conf/client_id.bin"
#define TRACKING_ID "UA-78516566-1"
#define GOOGLE_BASE_URL "www.google-analytics.com/collect"
#define KATZE_BASE_URL "saveasdotdmx.katzepower.com/ghettoanalytics.php"
#define TRACKING_APP_NAME "Dance%20Maniax%20Update"
int isDebugMode = 0;
void AnalyticsManager::initialize()
{
curl_global_init(CURL_GLOBAL_ALL);
getOrMakeClientID();
initialized = true;
@ -50,46 +47,16 @@ void AnalyticsManager::logEvent(const char* eventCategory, const char* eventType
}
logEventToServer(GOOGLE_BASE_URL, eventCategory, eventType, eventLabel, eventValue);
logEventToServer(KATZE_BASE_URL, eventCategory, eventType, eventLabel, eventValue);
}
void AnalyticsManager::logEventToServer(const char* serverURL, const char* eventCategory, const char* eventType, const char* eventLabel, int eventValue)
{
CURL* curl = curl_easy_init();
CURLcode res;
// construct the postfields using much string math
char postfields[512] = "";
sprintf_s(postfields, 512, "v=%d&tid=%s&an=%s&cid=%s&t=%s&ec=%s&ea=%s&debug=%d", 1, TRACKING_ID, TRACKING_APP_NAME, clientID, "event", eventCategory, eventType, isDebugMode);
if ( eventLabel[0] != 0 )
{
char* tempEncode = curl_easy_escape(curl, eventLabel, strlen(eventLabel));
strcat_s(postfields, 512, "&el=");
strcat_s(postfields, 512, tempEncode);
curl_free(tempEncode);
}
if ( eventValue != -1 )
{
char tempEncode[128] = "";
_itoa_s(eventValue, tempEncode, 64, 10);
strcat_s(postfields, 512, "&ev=");
strcat_s(postfields, 512, tempEncode);
}
// post the data using curl
if ( curl )
{
// post to Google Analytics first
curl_easy_setopt(curl, CURLOPT_URL, serverURL);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, postfields);
res = curl_easy_perform(curl);
if (res != CURLE_OK)
{
al_trace("curl_easy_perform() failed: %s\n", curl_easy_strerror(res));
}
curl_easy_cleanup(curl);
}
}
void AnalyticsManager::getOrMakeClientID()

View File

@ -2,6 +2,7 @@
// file created by Allen Seitz on 7/18/2009
// April 26, 2013: cleaned up many source files and moved into an svn repo
// November 29, 2015: cleaned up a few source files and moved into a git repo
// March 18, 2023: ported to Visual Studio 2019 but left the target platform x86
#include <stdio.h>
#include <stdlib.h>
@ -25,6 +26,17 @@
#include "../headers/videoManager.h"
//////////////////////////////////////////////////////////////////////////////
// ugly hack for compiling in 32 bit I guess (added in 2023)
//////////////////////////////////////////////////////////////////////////////
#define stdin (__acrt_iob_func(0))
#define stdout (__acrt_iob_func(1))
#define stderr (__acrt_iob_func(2))
FILE _iob[] = { *stdin, *stdout, *stderr };
extern "C" FILE * __cdecl __iob_func(void) { return _iob; }
//////////////////////////////////////////////////////////////////////////////
// Song List
//////////////////////////////////////////////////////////////////////////////
@ -273,7 +285,7 @@ int main()
// give players an option to disable tracking
if ( !fileExists("notracking") )
{
am.initialize();
//am.initialize();
}
if ( !fileExists("initial_install_complete.txt") )
@ -1449,8 +1461,8 @@ void mainBootLoop(UTIME dt)
textprintf(rm.m_backbuf, font, 50, 140, WHITE, "I/O CHECK:");
textprintf(rm.m_backbuf, font, 50, 160, WHITE, "DATA CHECK:");
textprintf(rm.m_backbuf, font, 50, 180, WHITE, "SOUND CHECK:");
textprintf(rm.m_backbuf, font, 50, 410, WHITE, "This program reports non-personal usage data to Google Analytics.");
textprintf(rm.m_backbuf, font, 50, 420, WHITE, "You may disable tracking by creating a file named \"notracking\".");
//textprintf(rm.m_backbuf, font, 50, 410, WHITE, "This program reports non-personal usage data to Google Analytics.");
//textprintf(rm.m_backbuf, font, 50, 420, WHITE, "You may disable tracking by creating a file named \"notracking\".");
if ( currentBootStep == 0 )
{