Handle broadcast JVS packets
This commit is contained in:
@@ -324,14 +324,22 @@ void mxjvs_handle(unsigned char* paddedIn, short inCount, unsigned char* outData
|
|||||||
}
|
}
|
||||||
|
|
||||||
unsigned char destination = inData[1];
|
unsigned char destination = inData[1];
|
||||||
if (destination == 0 || destination > jvs_num_boards) return;
|
// Not broadcast, not master-bound, and within bounds
|
||||||
|
if (destination != 0xff && (destination == 0 || destination > jvs_num_boards)) return;
|
||||||
|
|
||||||
unsigned char* response = malloc(maxOut);
|
unsigned char* response = malloc(maxOut);
|
||||||
jvs_board_t* board = &(*jvs_config)[jvs_num_boards - destination];
|
|
||||||
// jvs_board_t* board = &(*jvs_config)[0];
|
|
||||||
unsigned char packetSize;
|
unsigned char packetSize;
|
||||||
unsigned char status =
|
unsigned char status;
|
||||||
board->handler(board, inData + 3, inData[2] - 1, response + 4, &packetSize);
|
if (destination == 0xff) {
|
||||||
|
for (int i = 0; i < jvs_num_boards; i++) {
|
||||||
|
jvs_board_t* board = &(*jvs_config)[i];
|
||||||
|
status = board->handler(board, inData + 3, inData[2] - 1, response + 4, &packetSize);
|
||||||
|
if (packetSize != 0) break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
jvs_board_t* board = &(*jvs_config)[jvs_num_boards - destination];
|
||||||
|
status = board->handler(board, inData + 3, inData[2] - 1, response + 4, &packetSize);
|
||||||
|
}
|
||||||
free(inData);
|
free(inData);
|
||||||
|
|
||||||
if (status == JVS_STATUS_OK) {
|
if (status == JVS_STATUS_OK) {
|
||||||
@@ -637,10 +645,10 @@ jvs_board_t under_night_jvs_config[1] = {
|
|||||||
// },
|
// },
|
||||||
};
|
};
|
||||||
|
|
||||||
// jvs_board_t (*jvs_config)[] = &maimai_jvs_config;
|
jvs_board_t (*jvs_config)[] = &maimai_jvs_config;
|
||||||
// size_t jvs_num_boards = sizeof maimai_jvs_config / sizeof maimai_jvs_config[0];
|
size_t jvs_num_boards = sizeof maimai_jvs_config / sizeof maimai_jvs_config[0];
|
||||||
jvs_board_t (*jvs_config)[] = &under_night_jvs_config;
|
// jvs_board_t (*jvs_config)[] = &under_night_jvs_config;
|
||||||
size_t jvs_num_boards = sizeof under_night_jvs_config / sizeof under_night_jvs_config[0];
|
// size_t jvs_num_boards = sizeof under_night_jvs_config / sizeof under_night_jvs_config[0];
|
||||||
|
|
||||||
void setup_mxjvs() {
|
void setup_mxjvs() {
|
||||||
file_hook_t* mxjvs = new_file_hook(L"\\\\.\\mxjvs");
|
file_hook_t* mxjvs = new_file_hook(L"\\\\.\\mxjvs");
|
||||||
|
|||||||
@@ -99,7 +99,6 @@ void hook_file_with_buffer(LPCWSTR filename, LPBYTE buffer, DWORD nBytes, DWORD
|
|||||||
drive_redirect_t DRIVE_REDIRECT_TABLE[] = {
|
drive_redirect_t DRIVE_REDIRECT_TABLE[] = {
|
||||||
// Note: Had to create last_shime.log
|
// Note: Had to create last_shime.log
|
||||||
{ .drive = "C:\\Documents and Settings\\AppUser\\temp\\", .path = ".\\dev\\temp\\" },
|
{ .drive = "C:\\Documents and Settings\\AppUser\\temp\\", .path = ".\\dev\\temp\\" },
|
||||||
{ .drive = "E:\\", .path = "\\\\.\\E:" },
|
|
||||||
// {.drive = "C:\\ProgramData/boost_interprocess/", .path = "\\\\.\\ipc\\"},
|
// {.drive = "C:\\ProgramData/boost_interprocess/", .path = "\\\\.\\ipc\\"},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -155,10 +154,7 @@ BOOL redirect_path(LPCSTR path, LPCSTR* redirected) {
|
|||||||
|
|
||||||
// Don't redirect local paths
|
// Don't redirect local paths
|
||||||
GetCurrentDirectoryA(sizeof WORKING_DIR, WORKING_DIR);
|
GetCurrentDirectoryA(sizeof WORKING_DIR, WORKING_DIR);
|
||||||
if (strstr(path, WORKING_DIR) == path) {
|
if (strstr(path, WORKING_DIR) == path) return FALSE;
|
||||||
puts("SKIP");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((('a' <= path[0] && path[0] <= 'z') || ('A' <= path[0] && path[0] <= 'Z')) &&
|
if ((('a' <= path[0] && path[0] <= 'z') || ('A' <= path[0] && path[0] <= 'Z')) &&
|
||||||
path[1] == ':' && (path[2] == '/' || path[2] == '\\')) {
|
path[1] == ':' && (path[2] == '/' || path[2] == '\\')) {
|
||||||
|
|||||||
@@ -55,8 +55,8 @@ void make_default_config() {
|
|||||||
if (strlen(comment) != 0) fprintf_prefix(config_file, "; ", comment); \
|
if (strlen(comment) != 0) fprintf_prefix(config_file, "; ", comment); \
|
||||||
fprintf(config_file, "%s = %d ;(int)\n", #n, default);
|
fprintf(config_file, "%s = %d ;(int)\n", #n, default);
|
||||||
|
|
||||||
#define CFG_hex(s, n, precision, default, comment) \
|
#define CFG_hex(s, n, precision, default, comment) \
|
||||||
if (strlen(comment) != 0) fprintf_prefix(config_file, "; ", comment); \
|
if (strlen(comment) != 0) fprintf_prefix(config_file, "; ", comment); \
|
||||||
fprintf(config_file, "%s = %.*X ;(hex, %d byte%s)\n", #n, precision, 0x##default, precision, \
|
fprintf(config_file, "%s = %.*X ;(hex, %d byte%s)\n", #n, precision, 0x##default, precision, \
|
||||||
precision == 1 ? "" : "s");
|
precision == 1 ? "" : "s");
|
||||||
|
|
||||||
@@ -93,7 +93,6 @@ int handler(void *user, const char *section, const char *name, const char *value
|
|||||||
#define CFG_int(s, n, default, comment) \
|
#define CFG_int(s, n, default, comment) \
|
||||||
else if (_stricmp(section, #s) == 0 && _stricmp(name, #n) == 0) { \
|
else if (_stricmp(section, #s) == 0 && _stricmp(name, #n) == 0) { \
|
||||||
cfg->s.n = strtol(value, &end, 10); \
|
cfg->s.n = strtol(value, &end, 10); \
|
||||||
printf("%s.%s:%d\n", #s, #n, cfg->s.n);\
|
|
||||||
if (end == value || *end != '\0' || errno == ERANGE) cfg->s.n = default; \
|
if (end == value || *end != '\0' || errno == ERANGE) cfg->s.n = default; \
|
||||||
}
|
}
|
||||||
#define CFG_hex(s, n, precision, default, comment) \
|
#define CFG_hex(s, n, precision, default, comment) \
|
||||||
|
|||||||
Reference in New Issue
Block a user