Windows CTRL + C Hotkey

This commit is contained in:
Ade Novan 2016-10-25 18:35:52 +08:00 committed by Gde Made Novan Priambhada
parent 5187b9f118
commit f514b25c79
7 changed files with 41 additions and 14 deletions

View File

@ -996,14 +996,14 @@ void sendChat(std::string chatString) {
SceNetAdhocctlChatPacketC2S chat;
chat.base.opcode = OPCODE_CHAT;
//TODO check network inited, check send success or not, chatlog.pushback error on failed send, pushback error on not connected
//if (friendFinderRunning) //need to check network inited and already connected to server or not is this correct?
//{
if (friendFinderRunning)
{
// Send Chat to Server
if (!chatString.empty()) {
//maximum char allowed is 64 character for compability with original server (pro.coldbird.net)
message = chatString.substr(0, 60); // 64 return chat variable corrupted is it out of memory?
strcpy(chat.message, message.c_str());
//Send Chat Messages
//Send Chat Messages
int chatResult = send(metasocket, (const char *)&chat, sizeof(chat), 0);
NOTICE_LOG(SCENET, "Send Chat %s to Adhoc Server", chat.message);
name = g_Config.sNickName.c_str();
@ -1012,7 +1012,12 @@ void sendChat(std::string chatString) {
ch->UpdateChat();
}
}
//}
}else {
chatLog.push_back("You're in Offline Mode, go to lobby or online hall"); // use this or osm better?
if (ch) {
ch->UpdateChat();
}
}
}
@ -1140,9 +1145,6 @@ int friendFinder(){
// Move RX Buffer
memmove(rx, rx + sizeof(SceNetAdhocctlChatPacketS2C), sizeof(rx) - sizeof(SceNetAdhocctlChatPacketS2C));
// Move RX Buffer
memmove(rx, rx + sizeof(SceNetAdhocctlChatPacketS2C), sizeof(rx) - sizeof(SceNetAdhocctlChatPacketS2C));
// Fix RX Buffer Length
rxpos -= sizeof(SceNetAdhocctlChatPacketS2C);
}

View File

@ -29,7 +29,6 @@ void ChatMenu::CreatePopupContents(UI::ViewGroup *parent) {
chatVert_ = scroll_->Add(new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT)));
chatVert_->SetSpacing(0);
parent->Add(outer);
UpdateChat();
}
void ChatMenu::CreateViews() {
@ -56,6 +55,7 @@ void ChatMenu::CreateViews() {
CreatePopupContents(box_);
root_->SetDefaultFocusView(box_);
this->UpdateChat();
g_Config.iNewChat = 0;
}
@ -73,7 +73,6 @@ UI::EventReturn ChatMenu::OnSubmit(UI::EventParams &e) {
chatEdit_->SetFocus();
sendChat(chat);
#elif defined(__ANDROID__)
scroll_->ScrollToBottom();
System_SendMessage("inputbox", "Chat:");
#endif
return UI::EVENT_DONE;
@ -132,7 +131,7 @@ void ChatMenu::UpdateChat() {
v->SetTextColor(0xFF000000 | color);
}
}
toBottom_ = true;
this->ScrollChat();
}
}
@ -150,11 +149,20 @@ bool ChatMenu::touch(const TouchInput &touch) {
}
void ChatMenu::update(InputState &input) {
if (toBottom_) {
toBottom_ = false;
PopupScreen::update(input);
this->ScrollChat();
}
void ChatMenu::sendMessage(const char *message, const char *value) {
// Always call the base class method first to handle the most common messages.
PopupScreen::sendMessage(message, value);
this->ScrollChat();
}
void ChatMenu::ScrollChat() {
if (scroll_) {
scroll_->ScrollToBottom();
}
PopupScreen::update(input);
}
ChatMenu::~ChatMenu() {

View File

@ -12,6 +12,9 @@ public:
bool touch(const TouchInput &touch) override;
void update(InputState &input) override;
void UpdateChat();
void ScrollChat();
protected:
virtual void sendMessage(const char *message, const char *value);
private:
UI::EventReturn OnSubmit(UI::EventParams &e);
UI::TextEdit *chatEdit_;

View File

@ -371,6 +371,11 @@ void EmuScreen::sendMessage(const char *message, const char *value) {
} else {
gstate_c.skipDrawReason &= ~SKIPDRAW_WINDOW_MINIMIZED;
}
} else if (!strcmp(message, "chat screen")) {
releaseButtons();
ChatMenu * ch = new ChatMenu();
setChatPointer(ch);
screenManager()->push(ch);
}
}

View File

@ -344,6 +344,7 @@ namespace MainWindow {
TranslateMenuItem(menu, ID_OPTIONS_SHOWFPS);
TranslateMenuItem(menu, ID_EMULATION_SOUND);
TranslateMenuItem(menu, ID_EMULATION_CHEATS, L"\tCtrl+T");
TranslateMenuItem(menu, ID_EMULATION_CHAT, L"\tCtrl+C");
// Help menu: it's translated in CreateHelpMenu.
CreateHelpMenu(menu);
@ -648,7 +649,11 @@ namespace MainWindow {
g_Config.bEnableCheats = !g_Config.bEnableCheats;
osm.ShowOnOff(gr->T("Cheats"), g_Config.bEnableCheats);
break;
case ID_EMULATION_CHAT:
if (GetUIState() == UISTATE_INGAME) {
NativeMessageReceived("chat screen", "");
}
break;
case ID_FILE_LOADSTATEFILE:
if (W32Util::BrowseForFileName(true, hWnd, L"Load state", 0, L"Save States (*.ppst)\0*.ppst\0All files\0*.*\0\0", L"ppst", fn)) {
SetCursor(LoadCursor(0, IDC_WAIT));

View File

@ -68,6 +68,7 @@ BEGIN
"W", ID_EMULATION_STOP, VIRTKEY, CONTROL, NOINVERT
"B", ID_EMULATION_RESET, VIRTKEY, CONTROL, NOINVERT
"T", ID_EMULATION_CHEATS, VIRTKEY, CONTROL, NOINVERT
"C", ID_EMULATION_CHAT, VIRTKEY, CONTROL, NOINVERT
"D", ID_DEBUG_DISASSEMBLY, VIRTKEY, CONTROL, NOINVERT
"G", ID_DEBUG_GEDEBUGGER, VIRTKEY, CONTROL, NOINVERT
"L", ID_DEBUG_LOG, VIRTKEY, CONTROL, NOINVERT
@ -559,6 +560,7 @@ BEGIN
MENUITEM "Enable Sound", ID_EMULATION_SOUND, CHECKED
MENUITEM SEPARATOR
MENUITEM "Enable Cheats", ID_EMULATION_CHEATS
MENUITEM "Enable Chat", ID_EMULATION_CHAT
END
END

View File

@ -334,6 +334,8 @@
#define ID_FILE_DUMPAUDIO 40167
#define ID_HELP_GITHUB 40168
#define IDC_GEDBG_RECORD 40169
#define ID_EMULATION_CHAT 40168
// Dummy option to let the buffered rendering hotkey cycle through all the options.
#define ID_OPTIONS_BUFFEREDRENDERINGDUMMY 40500