Giter VIP home page Giter VIP logo

novadrop's People

Contributors

alexrp avatar dependabot[bot] avatar roukanken42 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

novadrop's Issues

Process XML errors in validate/pack commands

Hi. When runningcommand validate/pack command, I would like to be able to get the XML filename in which there is an error.
For example like this:

Unhandled exception: System.Xml.XmlException: '<', hexadecimal value 0x3C, is an invalid attribute character. Line 12, position 44.
   at System.Xml.XmlTextReaderImpl.ParseAttributeValueSlowAsync(Int32 curPos, Char quoteChar, NodeData attr)
   at System.Xml.XmlTextReaderImpl.ParseAttributesAsync()
   at System.Xml.AsyncHelper.ReturnTrueTaskWhenFinishCoreAsync(Task task)
   at System.Xml.XsdValidatingReader._ReadAsync_Read(Task`1 task)
   at Vezel.Novadrop.Commands.ValidateCommand.<>c__DisplayClass0_0.<<-ctor>b__1>d.MoveNext() in F:\novadrop-master\src\tools\dc\Commands\ValidateCommand.cs:line 51

Implement the Vezel.Novadrop.Net library

We need:

  • Support for the null cipher.
  • Support for the PIKE cipher.
  • Support for the checksum algorithm.
  • Support for TERA's packet serialization system. (Source generators?)
  • A convenient connection class neatly wrapping the above + a socket.

See also:

Add a Vezel.Novadrop.Cryptography library

This will cover:

  • The 256-bit XOR cipher used for resource container files.
  • The PIKE cipher used for network encryption.
  • The (incorrect) SHA-0 implementation used for the PIKE key exchange.
  • Maybe the modified CRC32 used for data center strings?

Investigate unknown and/or unobserved client/launcher window messages

Tl.exe -> launcher.exe:

  • 0 (csPopup() and promoPopup(%d) only; gameEvent(%d) and endPopup(%d) are understood)
  • 4 (ticket; not observed; unclear how it relates to 8)
  • 5 (last_svr; not observed)
  • 6 (char_cnt; not observed)
  • 7 (not observed)
  • 8 (ticket; not observed; unclear how it relates to 4)
  • 10 (getWebLinkUrl(%d,%s))

(Note that launcher.exe only ever replies to Tl.exe with the same message ID it received; it does not send its own messages.)

TERA.exe -> Tl.exe:

  • 24
  • 25 (potentially related to opening a Web browser; not observed)
  • 26 (some kind of binary data; includes the data sent to launcher.exe as getWebLinkUrl(%d,%s) with ID 10)
  • 1000 (some kind of binary data; includes the Windows user name)
  • 100x and 101x (usually empty; forwarded to launcher.exe as gameEvent(%d) with ID 0)
    • 1001, 1002, 1003, 1004, 1011, and 1012 (observed)
    • 1005, 1006, 1007, 1008, 1009, 1010, 1013, and 1016 (not observed)
  • 1020 (sent on normal exit; binary data including the exit reason sent to launcher.exe as endPopup(%d) with ID 0)
  • 1021 (sent if the client crashes; string with exception details)
  • 1022 (seems to mean "XIGNCODE3 starting"; not observed)
  • 1023 (seems to mean "XIGNCODE3 started"; not observed)
  • 1024 (seems to mean "XIGNCODE3 failed to start"; includes the value of GetLastError in the high bits of a 64-bit integer; not observed)
  • 1025 (seems to mean "please open the customer support website"; not observed)
  • 1027 (seems related to cash shop purchases; not observed)

(Tl.exe only ever acts on request messages received by TERA.exe. In response to those, it may send messages to launcher.exe to retrieve data. The reply messages sent back to TERA.exe will have a different message ID than the request message ID.)

Tl.exe -> TERA.exe:

  • 27 (sent in response to message 26)

novadrop-dc should output validation diagnostics in a more machine-friendly way

public void Print()
{
if (_problems.Count == 0)
return;
Log.WriteLine();
foreach (var fileGroup in _problems.GroupBy(tup => tup.File.Name))
{
var shownProblems = fileGroup.Take(10).ToArray();
Log.WriteLine($"{fileGroup.Key}:");
foreach (var (_, line, col, severity, msg) in shownProblems)
{
var (type, color) = severity switch
{
XmlSeverityType.Error => ('E', "red"),
XmlSeverityType.Warning => ('W', "yellow"),
_ => throw new UnreachableException(),
};
Log.MarkupLineInterpolated($" [[[{color}]{type}[/]]] ([blue]{line}[/],[blue]{col}[/]): {msg}");
}
var remainingProblems = fileGroup.Count() - shownProblems.Length;
if (remainingProblems != 0)
Log.MarkupLineInterpolated($" ... [darkorange]{remainingProblems}[/] more problem(s) ...");
}
Log.WriteLine();
}

This output format is nice for direct human interaction but is super annoying to parse from other tools. When console output is redirected, we should instead write something standard like <file>(<line>,<column>): <severity>: <message> and avoid grouping the messages under file name headings. Among other things, writing diagnostics this way integrates better with MSBuild.

Deduplication of data center nodes and attributes

Right now, we make no effort at all to deduplicate nodes and attributes. This means that data center files we produce are roughly 2x the size of official data center files.

This would have been a bigger issue in the past when TERA was 32-bit. But with the move to 64-bit, memory is effectively a non-issue. On the other hand, if people are producing multiple translated data center files for their servers, the size increase starts to add up, making distribution of the files more of an issue.

It might be good to provide an optional mode that attempts to deduplicate nodes and attributes to bring the size down at the cost of potentially much longer packing time.

Freezes in game after repacking DC

Related to #25
I also confirm this problem.

The problem appears after repacking, even if no changes have been made to the files. There are no errors during unpacking/packing.

Investigate significance of some JSON values sent from `launcher.exe` to `Tl.exe`

sealed class LauncherGameInfo
{
// TODO: account_bits, access_level, chars_per_server, user_permission
[JsonPropertyName("result-code")]
public int ResultCode { get; } = 200;
[JsonPropertyName("game_account_name")]
public string GameAccountName { get; } = "TERA";
[JsonPropertyName("master_account_name")]
public string MasterAccountName { get; }
[JsonPropertyName("ticket")]
public string Ticket { get; }
[JsonPropertyName("last_connected_server_id")]
public int LastServerId { get; }
public LauncherGameInfo(string accountName, string ticket, int lastServerId)
{
MasterAccountName = accountName;
Ticket = ticket;
LastServerId = lastServerId;
}
}

I seem to remember that they are not actually used by Tl.exe for anything (except chars_per_server), hence their omission in LauncherGameInfo, but we should confirm that.

Support older data center format versions

In particular:

  • The 32-bit variant of the current version 6.
  • The 2012-era version 3 (only 32-bit).

This would require rethinking of how the data center code is structured. In particular, since nodes and attributes have different layout, we'd need helper functions to access the raw fields correctly. Possibly other stuff.

`DataCenterExtensions.Descendants()` algorithm is incorrect

public static IEnumerable<DataCenterNode> Descendants(this DataCenterNode node)
{
Check.Null(node);
var work = new Queue<DataCenterNode>();
work.Enqueue(node);
while (work.Count != 0)
{
var current = work.Dequeue();
if (!current.HasChildren)
continue;
foreach (var elem in current.Children)
{
yield return elem;
work.Enqueue(elem);
}
}
}

This will not give the order that most people would probably expect.

Expose key flags on `DataCenterNode`

// TODO: Should we allow setting 0b0001 in the API?
if (keyFlags is not 0b0000 or 0b0001)
throw new InvalidDataException($"Node has invalid key flags 0x{keyFlags:x1}.");

`key_flags` is `0` in official data center files. It may have a combination of
the following values:
```cpp
enum DataCenterKeyFlags : uint8_t
{
DATA_CENTER_KEY_FLAGS_NONE = 0b0000,
DATA_CENTER_KEY_FLAGS_UNCACHED = 0b0001,
};
```
If `DATA_CENTER_KEY_FLAGS_UNCACHED` is set, the results of a query against this
node will not be cached by the client.

Introduce a Vezel.Novadrop.Interop library for in-memory client interaction (.NET 8)

This library will provide type definitions and function bindings for many of the common classes used in TERA. A few obvious examples:

  • S1Context, S1CallbackHandler
  • S1DataDB, S1DataQuery, S1DataNode, S1DataAttribute
  • S1GameObject, S1Player, S1User
  • S1ConnectionManager, S1CommandQueue
  • S1ClientSocket, S1CryptSocket
  • Cipher, NullCipher, PikeCipher

The goal is for this library to enable a wide array of in-memory modding scenarios.

Note: Only the unpacked r387486 client will be supported out of the box, but the library should enable people to plug in their own addresses or search patterns (e.g. for r367239).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.