* Trying to fix Issue #88.
* Fix a grammar mistake.
* Add single comment without name with symbol naming dialog.
This commit is contained in:
owomomo 2020-12-19 17:31:30 +08:00 committed by GitHub
parent b01728f620
commit 6e0a5a391b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 38 additions and 17 deletions

View File

@ -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");
}
}
}

View File

@ -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;
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);
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;
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)
{

View File

@ -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");

Binary file not shown.