<commit_before>#include "game/ht.h"
#include "game/sdl/hosthelpers.h"
#include "base/tick.h"
#include "base/log.h"
#include "base/thread.h"
#include "base/md5.h"
#include "game/httppackmanager.h"
#include "game/httppackinfomanager.h"
#include "game/httpservice.h"
#include "game/completemanager.h"
#include <sys/types.h>
#include <errno.h>
#include <SDL.h>

namespace wi {

SdlPackFileReader gpakr;
HttpPackManager *gppackm;
HttpPackInfoManager *gppim;
CompleteManager *gpcptm;

char *gpszUdid;

bool HostInit()
{
    HostHelpers::Init();

    //
    gppackm = new HttpPackManager(gphttp, HostHelpers::GetMissionPacksDir(), HostHelpers::GetTempDir());
    gppackm->InitFromInstalled();
    gppim = new HttpPackInfoManager(gphttp, HostHelpers::GetMissionPackInfosDir(), HostHelpers::GetTempDir());
    gpcptm = new CompleteManager(HostHelpers::GetCompletesDir());
    gpcptm->Init();

	// TODO(darrinm): get user id (gpszUdid)

    return true;
}

void HostExit()
{
    delete gppim;
    delete gppackm;

    HostHelpers::Cleanup();
}

const char *HostGetDeviceId() {
    // Hash it so query params aren't obnoxious                                 
    MD5_CTX md5;
    MD5Init(&md5);
    const char *udid = HostHelpers::GetUdid();
    MD5Update(&md5, (const byte *)udid, strlen(udid));
    byte hash[16];
    MD5Final(hash, &md5);
    return base::Format::ToHex(hash, 16);
}

void HostInitiateWebView(const char *title, const char *url) {
    return HostHelpers::InitiateWebView(title, url);
}

IChatController *HostGetChatController() {
    return HostHelpers::GetChatController();
}

void HostInitiateAsk(const char *title, int max, const char *def,
        int keyboard, bool secure) {
    return HostHelpers::InitiateAsk(title, max, def, keyboard, secure);
}
<commit_msg>SDL host HostGetDeviceId() -> HostGenerateDeviceId()<commit_after>#include "game/ht.h"
#include "game/sdl/hosthelpers.h"
#include "base/tick.h"
#include "base/log.h"
#include "base/thread.h"
#include "base/md5.h"
#include "game/httppackmanager.h"
#include "game/httppackinfomanager.h"
#include "game/httpservice.h"
#include "game/completemanager.h"
#include <sys/types.h>
#include <errno.h>
#include <SDL.h>

namespace wi {

SdlPackFileReader gpakr;
HttpPackManager *gppackm;
HttpPackInfoManager *gppim;
CompleteManager *gpcptm;

char *gpszUdid;

bool HostInit()
{
    HostHelpers::Init();

    //
    gppackm = new HttpPackManager(gphttp, HostHelpers::GetMissionPacksDir(), HostHelpers::GetTempDir());
    gppackm->InitFromInstalled();
    gppim = new HttpPackInfoManager(gphttp, HostHelpers::GetMissionPackInfosDir(), HostHelpers::GetTempDir());
    gpcptm = new CompleteManager(HostHelpers::GetCompletesDir());
    gpcptm->Init();

	// TODO(darrinm): get user id (gpszUdid)

    return true;
}

void HostExit()
{
    delete gppim;
    delete gppackm;

    HostHelpers::Cleanup();
}

const char *HostGenerateDeviceId() {
    // Hash it so query params aren't obnoxious                                 
    MD5_CTX md5;
    MD5Init(&md5);
    const char *udid = HostHelpers::GetUdid();
    MD5Update(&md5, (const byte *)udid, strlen(udid));
    byte hash[16];
    MD5Final(hash, &md5);
    return base::Format::ToHex(hash, 16);
}

void HostInitiateWebView(const char *title, const char *url) {
    return HostHelpers::InitiateWebView(title, url);
}

IChatController *HostGetChatController() {
    return HostHelpers::GetChatController();
}

void HostInitiateAsk(const char *title, int max, const char *def,
        int keyboard, bool secure) {
    return HostHelpers::InitiateAsk(title, max, def, keyboard, secure);
}

{'fraction_non_alphanumeric': 0.13633834168057873, 'fraction_numerical': 0.007234279354479688, 'mean_word_length': 4.430513595166163, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6464958', 'n_tokens_mistral': 1276, 'n_tokens_neox': 1270, 'n_words': 267}