diff --git a/src/drivers/win/debugger.cpp b/src/drivers/win/debugger.cpp index e13377e4..a2802ad4 100644 --- a/src/drivers/win/debugger.cpp +++ b/src/drivers/win/debugger.cpp @@ -546,13 +546,14 @@ void Disassemble(HWND hWnd, int id, int scrollid, unsigned int addr) { // make a copy strcpy(debug_str_decoration_comment, node->comment); - strcat(debug_str_decoration_comment, "\n"); + strcat(debug_str_decoration_comment, "\r\n"); // divide the debug_str_decoration_comment into strings (Comment1, Comment2, ...) debug_decoration_comment = debug_str_decoration_comment; - debug_decoration_comment_end_pos = strstr(debug_decoration_comment, "\n"); + debug_decoration_comment_end_pos = strstr(debug_decoration_comment, "\r\n"); while (debug_decoration_comment_end_pos) { debug_decoration_comment_end_pos[0] = 0; // set \0 instead of \r + debug_decoration_comment_end_pos[1] = 0; // set \0 instead of \n strcat(debug_str, "; "); strcat(debug_str, debug_decoration_comment); strcat(debug_str, "\n"); @@ -563,7 +564,7 @@ void Disassemble(HWND hWnd, int id, int scrollid, unsigned int addr) debug_decoration_comment_end_pos += 2; debug_decoration_comment = debug_decoration_comment_end_pos; - debug_decoration_comment_end_pos = strstr(debug_decoration_comment_end_pos, "\n"); + debug_decoration_comment_end_pos = strstr(debug_decoration_comment_end_pos, "\r\n"); } } } diff --git a/src/drivers/win/debuggersp.cpp b/src/drivers/win/debuggersp.cpp index 76d323b4..766117c9 100644 --- a/src/drivers/win/debuggersp.cpp +++ b/src/drivers/win/debuggersp.cpp @@ -368,7 +368,7 @@ Name* parse(char* lines, const char* filename) size = strstr(cur->offset, "/"); - if (size) // Array definition line + if (size && cur->name) // Array definition line { int arrlen, offset; @@ -485,7 +485,6 @@ Name* parseNameFile(const char* filename) n = parse(buffer, filename); fclose(f); - free(buffer); } } @@ -1024,7 +1023,7 @@ void AddNewSymbolicName(uint16 newAddress, char* newOffset, char* newName, char* break; } - if (*newName) + if (*newName || *newComment) { if (!initialNode) { @@ -1033,8 +1032,15 @@ void AddNewSymbolicName(uint16 newAddress, char* newOffset, char* newName, char* node->offset = (char*)malloc(strlen(newOffset) + 1); strcpy(node->offset, newOffset); node->offsetNumeric = newAddress; - node->name = (char*)malloc(strlen(newName) + 1); - strcpy(node->name, newName); + if (strlen(newName)) + { + node->name = (char*)malloc(strlen(newName) + 1); + strcpy(node->name, newName); + } + else + { + node->name = 0; + } if (strlen(newComment)) { node->comment = (char*)malloc(strlen(newComment) + 1); @@ -1055,17 +1061,25 @@ void AddNewSymbolicName(uint16 newAddress, char* newOffset, char* newName, char* // found matching address - replace its name and comment if (node->name) free(node->name); - node->name = (char*)malloc(strlen(newName) + 1); - strcpy(node->name, newName); + if (strlen(newName)) + { + node->name = (char*)malloc(strlen(newName) + 1); + strcpy(node->name, newName); + } else + { + node->name = 0; + } if (node->comment) { free(node->comment); - node->comment = 0; } if (strlen(newComment)) { node->comment = (char*)malloc(strlen(newComment) + 1); strcpy(node->comment, newComment); + } else + { + node->comment = 0; } break; } @@ -1080,14 +1094,20 @@ void AddNewSymbolicName(uint16 newAddress, char* newOffset, char* newName, char* newNode->offset = (char*)malloc(strlen(newOffset) + 1); strcpy(newNode->offset, newOffset); newNode->offsetNumeric = newAddress; - newNode->name = (char*)malloc(strlen(newName) + 1); - strcpy(newNode->name, newName); + + if (strlen(newName)) + { + newNode->name = (char*)malloc(strlen(newName) + 1); + strcpy(newNode->name, newName); + } + else { + newNode->name = 0; + } if (strlen(newComment)) { newNode->comment = (char*)malloc(strlen(newComment) + 1); strcpy(newNode->comment, newComment); - } else - { + } else { newNode->comment = 0; } newNode->next = 0; @@ -1097,7 +1117,7 @@ void AddNewSymbolicName(uint16 newAddress, char* newOffset, char* newName, char* } } else { - // name field is empty - remove the address from the list + // name and comment field are all empty - remove the address from the list Name* previousNode = 0; while (node) { diff --git a/src/drivers/win/memview.cpp b/src/drivers/win/memview.cpp index 4752071a..fe97cde4 100644 --- a/src/drivers/win/memview.cpp +++ b/src/drivers/win/memview.cpp @@ -2429,7 +2429,7 @@ LRESULT CALLBACK MemViewCallB(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa if (discardBookmarkCount || outOfRangeBookmarkCount) { char reason[64]; - sprintf(buffer, "Import complete, but %d bookmark%s %s are not imported:\n", discardBookmarkCount + outOfRangeBookmarkCount, discardBookmarkCount + outOfRangeBookmarkCount == 1 ? "" : "s", discardBookmarkCount + outOfRangeBookmarkCount == 1 ? "is" : "are"); + sprintf(buffer, "Import complete, but %d bookmark%s %s not imported:\n", discardBookmarkCount + outOfRangeBookmarkCount, discardBookmarkCount + outOfRangeBookmarkCount == 1 ? "" : "s", discardBookmarkCount + outOfRangeBookmarkCount == 1 ? "is" : "are"); if (outOfRangeBookmarkCount) { sprintf(reason, "%d %s outside the valid address range of the game.", outOfRangeBookmarkCount, outOfRangeBookmarkCount == 1 ? "is" : "are"); diff --git a/src/drivers/win/res.aps b/src/drivers/win/res.aps deleted file mode 100644 index 9d042afd..00000000 Binary files a/src/drivers/win/res.aps and /dev/null differ