Artikash / Textractor

Extracts text from video games and visual novels. Highly extensible.
GNU General Public License v3.0
2.12k stars 204 forks source link

Higurashi Steam version - Minor issue with repeated text #324

Closed delcol431 closed 4 years ago

delcol431 commented 4 years ago

In Higurashi when you advance the text all the previous sentences on the screen get extracted again. In the attached picture the red lines indicate where the line break happened, and the text gets repeated in the textractor window. This happens in all the working hooks.

Higurashi_issue

I already tried the various extensions but i could not get a better result.

In addition, the hooks "mono_string_new_utf16", "mono_string_new" and "mono_string_new_len" (altough i'm fairly positive it's mostly because of the first one, which only shows non supported characters) cause huge performance issues on schene changes. Those hooks ignore the configuration file, but removing them manually resolves all performance issues, and greatly improve performance without a configuration file.

Artikash commented 4 years ago

The `Remove 30 Repeated Sentences" extension might help. Add it, read through a few lines, and then look through all the hooks again.

Artikash commented 4 years ago

Also fixable with this simple extension:

#include "Extension.h"
#include <mutex>

bool ProcessSentence(std::wstring& sentence, SentenceInfo sentenceInfo)
{
if (sentenceInfo["current select"] == 0 || sentenceInfo["text number"] == 0) return false;

static std::mutex m;
static std::wstring previous;

std::wregex reg (L"\\s");
sentence = std::regex_replace(sentence, reg, L""); //Removing all whitespace from the sentence, text does not always match otherwise

m.lock(); //lock mutex before using previous to prevent race conditions
size_t found = sentence.find(previous); //Searches for an exact match in order to avoid unwanted behaviour

if (found != -1) //Case "sentence" matches "previous"
{
sentence.erase(0, previous.length());
previous += sentence;
m.unlock();
return true;
}
else
{
previous = sentence;
m.unlock();
return true; //Returning true in order to keep the removal of the whitespace.
} //Keeps all the sentences consistent, always not needed
}
Ikuze321 commented 3 years ago

I'm trying to play this game and having a ton of issues. I also don't get how I get that extension or even the name of it honestly... I don't know coding it's just a wall of code to me.

I also have WAY too many hooks and way too many of them are just a jumble of random english words. Also can't get the regex filter that filters out english words to work. can get any regex filter to work.