add generate-product command
This commit is contained in:
@@ -79,6 +79,7 @@ add_executable(newserv
|
||||
src/NetworkAddresses.cc
|
||||
src/PatchFileIndex.cc
|
||||
src/Player.cc
|
||||
src/Product.cc
|
||||
src/ProxyCommands.cc
|
||||
src/ProxyServer.cc
|
||||
src/PSOEncryption.cc
|
||||
|
||||
+29
-2
@@ -21,6 +21,7 @@
|
||||
#include "IPStackSimulator.hh"
|
||||
#include "Loggers.hh"
|
||||
#include "NetworkAddresses.hh"
|
||||
#include "Product.hh"
|
||||
#include "ProxyServer.hh"
|
||||
#include "PSOGCObjectGraph.hh"
|
||||
#include "ReplaySession.hh"
|
||||
@@ -217,6 +218,8 @@ enum class Behavior {
|
||||
PARSE_OBJECT_GRAPH,
|
||||
REPLAY_LOG,
|
||||
CAT_CLIENT,
|
||||
GENERATE_PRODUCT,
|
||||
PRODUCT_SPEED_TEST,
|
||||
};
|
||||
|
||||
static bool behavior_takes_input_filename(Behavior b) {
|
||||
@@ -285,6 +288,8 @@ int main(int argc, char** argv) {
|
||||
const char* replay_required_password = "";
|
||||
uint32_t root_object_address = 0;
|
||||
uint16_t ep3_card_id = 0xFFFF;
|
||||
uint8_t domain = 1;
|
||||
uint8_t subdomain = 0xFF;
|
||||
for (int x = 1; x < argc; x++) {
|
||||
if (!strcmp(argv[x], "--help")) {
|
||||
print_usage();
|
||||
@@ -305,10 +310,14 @@ int main(int argc, char** argv) {
|
||||
cli_version = GameVersion::BB;
|
||||
} else if (!strncmp(argv[x], "--seed=", 7)) {
|
||||
seed = &argv[x][7];
|
||||
} else if (!strncmp(argv[x], "--sys=", 6)) {
|
||||
system_filename = &argv[x][6];
|
||||
} else if (!strncmp(argv[x], "--key=", 6)) {
|
||||
key_file_name = &argv[x][6];
|
||||
} else if (!strncmp(argv[x], "--sys=", 6)) {
|
||||
system_filename = &argv[x][6];
|
||||
} else if (!strncmp(argv[x], "--domain=", 9)) {
|
||||
domain = atoi(&argv[x][9]);
|
||||
} else if (!strncmp(argv[x], "--subdomain=", 12)) {
|
||||
subdomain = atoi(&argv[x][12]);
|
||||
} else if (!strncmp(argv[x], "--encrypted=", 12)) {
|
||||
find_decryption_seed_ciphertext = &argv[x][12];
|
||||
} else if (!strncmp(argv[x], "--decrypted=", 12)) {
|
||||
@@ -389,6 +398,10 @@ int main(int argc, char** argv) {
|
||||
behavior = Behavior::EXTRACT_GSL;
|
||||
} else if (!strcmp(argv[x], "extract-bml")) {
|
||||
behavior = Behavior::EXTRACT_BML;
|
||||
} else if (!strcmp(argv[x], "generate-product")) {
|
||||
behavior = Behavior::GENERATE_PRODUCT;
|
||||
} else if (!strcmp(argv[x], "product-speed-test")) {
|
||||
behavior = Behavior::PRODUCT_SPEED_TEST;
|
||||
} else {
|
||||
throw invalid_argument(string_printf("unknown command: %s (try --help)", argv[x]));
|
||||
}
|
||||
@@ -991,6 +1004,20 @@ int main(int argc, char** argv) {
|
||||
break;
|
||||
}
|
||||
|
||||
case Behavior::GENERATE_PRODUCT: {
|
||||
auto product = generate_product(domain, subdomain);
|
||||
fprintf(stderr, "%s\n", product.c_str());
|
||||
break;
|
||||
}
|
||||
|
||||
case Behavior::PRODUCT_SPEED_TEST:
|
||||
if (seed.empty()) {
|
||||
product_speed_test();
|
||||
} else {
|
||||
product_speed_test(stoul(seed, nullptr, 16));
|
||||
}
|
||||
break;
|
||||
|
||||
case Behavior::REPLAY_LOG:
|
||||
case Behavior::RUN_SERVER: {
|
||||
bool is_replay = behavior == Behavior::REPLAY_LOG;
|
||||
|
||||
+1299
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
|
||||
|
||||
bool product_is_valid(
|
||||
const std::string& s, uint8_t domain, uint8_t subdomain = 0xFF);
|
||||
bool product_is_valid_fast(
|
||||
const std::string& s, uint8_t domain, uint8_t subdomain = 0xFF);
|
||||
std::string generate_product(uint8_t domain, uint8_t subdomain = 0xFF);
|
||||
|
||||
void product_speed_test(uint64_t seed = 0xFFFFFFFFFFFFFFFF);
|
||||
Reference in New Issue
Block a user