mirror of
https://github.com/whoahq/whoa.git
synced 2026-02-01 16:22:45 +03:00
chore(net): move CanRead helper out of CDataStore
This commit is contained in:
parent
4bd4868531
commit
f5a0e009eb
@ -93,7 +93,7 @@ int32_t Grunt::ClientLink::CmdAuthLogonChallenge(CDataStore& msg) {
|
|||||||
msg.Get(generatorLen);
|
msg.Get(generatorLen);
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
// if (!msg.Sub8CBBF0(v31 + 1)) {
|
// if (!CanRead(msg, v31 + 1)) {
|
||||||
// return 0;
|
// return 0;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
@ -104,7 +104,7 @@ int32_t Grunt::ClientLink::CmdAuthLogonChallenge(CDataStore& msg) {
|
|||||||
msg.Get(largeSafePrimeLen);
|
msg.Get(largeSafePrimeLen);
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
// if (!msg.sub_8CBBF0(v32 + 48)) {
|
// if (!CanRead(msg, v32 + 48)) {
|
||||||
// return 0;
|
// return 0;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
@ -118,7 +118,7 @@ int32_t Grunt::ClientLink::CmdAuthLogonChallenge(CDataStore& msg) {
|
|||||||
msg.GetDataInSitu(reinterpret_cast<void*&>(versionChallenge), 16);
|
msg.GetDataInSitu(reinterpret_cast<void*&>(versionChallenge), 16);
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
// if (!msg.Sub8CBBF0(1)) {
|
// if (!CanRead(msg, 1)) {
|
||||||
// return 0;
|
// return 0;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
@ -139,7 +139,7 @@ int32_t Grunt::ClientLink::CmdAuthLogonChallenge(CDataStore& msg) {
|
|||||||
// PIN
|
// PIN
|
||||||
if (logonFlags & 0x1) {
|
if (logonFlags & 0x1) {
|
||||||
// TODO
|
// TODO
|
||||||
// if (!msg.Sub8CBBF0(20)) {
|
// if (!CanRead(msg, 20) {
|
||||||
// return 0;
|
// return 0;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
@ -151,7 +151,7 @@ int32_t Grunt::ClientLink::CmdAuthLogonChallenge(CDataStore& msg) {
|
|||||||
if (logonFlags & 0x2) {
|
if (logonFlags & 0x2) {
|
||||||
// TODO
|
// TODO
|
||||||
/*
|
/*
|
||||||
if (msg.Sub8CBBF0(12)) {
|
if (CanRead(msg, 12)) {
|
||||||
msg.Get(matrixWidth);
|
msg.Get(matrixWidth);
|
||||||
msg.Get(matrixHeight);
|
msg.Get(matrixHeight);
|
||||||
msg.Get(matrixDigitCount);
|
msg.Get(matrixDigitCount);
|
||||||
@ -170,7 +170,7 @@ int32_t Grunt::ClientLink::CmdAuthLogonChallenge(CDataStore& msg) {
|
|||||||
// TOKEN (authenticator)
|
// TOKEN (authenticator)
|
||||||
if (logonFlags & 0x4) {
|
if (logonFlags & 0x4) {
|
||||||
// TODO
|
// TODO
|
||||||
// if (!msg.Sub8CBBF0(1)) {
|
// if (!CanRead(msg, 1)) {
|
||||||
// return 0;
|
// return 0;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
#define NET_GRUNT_COMMAND_HPP
|
#define NET_GRUNT_COMMAND_HPP
|
||||||
|
|
||||||
#include "net/Grunt.hpp"
|
#include "net/Grunt.hpp"
|
||||||
|
#include "net/grunt/Util.hpp"
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
class Grunt::Command {
|
class Grunt::Command {
|
||||||
@ -19,7 +20,7 @@ class Grunt::Command {
|
|||||||
template <class T>
|
template <class T>
|
||||||
int32_t Grunt::Command<T>::Process(CDataStore& msg, Command<T>* commands, uint32_t commandCount, T& a4, uint32_t& pos) {
|
int32_t Grunt::Command<T>::Process(CDataStore& msg, Command<T>* commands, uint32_t commandCount, T& a4, uint32_t& pos) {
|
||||||
while (true) {
|
while (true) {
|
||||||
if (!msg.Sub8CBBF0(1)) {
|
if (!CanRead(msg, 1)) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
7
src/net/grunt/Util.cpp
Normal file
7
src/net/grunt/Util.cpp
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#include "net/grunt/Util.hpp"
|
||||||
|
#include <common/DataStore.hpp>
|
||||||
|
|
||||||
|
// Invented name. Appears to be private to Grunt. Found at 8CBBF0 in 3.3.5a (Windows).
|
||||||
|
bool CanRead(const CDataStore& msg, uint32_t bytes) {
|
||||||
|
return msg.IsValid() && msg.Size() - msg.Tell() >= bytes;
|
||||||
|
}
|
||||||
10
src/net/grunt/Util.hpp
Normal file
10
src/net/grunt/Util.hpp
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#ifndef NET_GRUNT_UTIL_HPP
|
||||||
|
#define NET_GRUNT_UTIL_HPP
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
class CDataStore;
|
||||||
|
|
||||||
|
bool CanRead(const CDataStore& msg, uint32_t bytes);
|
||||||
|
|
||||||
|
#endif
|
||||||
Loading…
Reference in New Issue
Block a user