Removed the Lua script console and Externals/Lua. The script console was incomplete and no one was working on it.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7051 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Jordan Woyak
2011-02-03 20:41:23 +00:00
parent 1619e176ff
commit dfe84ce0ac
83 changed files with 26 additions and 23410 deletions

View File

@ -32,7 +32,6 @@ if(wxWidgets_FOUND)
Src/ISOFile.cpp
Src/ISOProperties.cpp
Src/LogWindow.cpp
Src/LuaWindow.cpp
Src/Main.cpp
Src/MemcardManager.cpp
Src/MemoryCards/GCMemcard.cpp

View File

@ -320,7 +320,6 @@ xcopy "$(SolutionDir)..\Externals\SDL\$(PlatformName)\*.dll" "$(TargetDir)" /e /
<ClCompile Include="Src\ISOFile.cpp" />
<ClCompile Include="Src\ISOProperties.cpp" />
<ClCompile Include="Src\LogWindow.cpp" />
<ClCompile Include="Src\LuaWindow.cpp" />
<ClCompile Include="Src\Main.cpp" />
<ClCompile Include="Src\MainNoGUI.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
@ -338,6 +337,7 @@ xcopy "$(SolutionDir)..\Externals\SDL\$(PlatformName)\*.dll" "$(TargetDir)" /e /
<ClCompile Include="Src\NetPlayServer.cpp" />
<ClCompile Include="Src\NetWindow.cpp" />
<ClCompile Include="Src\PatchAddEdit.cpp" />
<ClCompile Include="Src\PHackSettings.cpp" />
<ClCompile Include="Src\stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='DebugFast|Win32'">Create</PrecompiledHeader>
@ -367,7 +367,6 @@ xcopy "$(SolutionDir)..\Externals\SDL\$(PlatformName)\*.dll" "$(TargetDir)" /e /
<ClInclude Include="Src\ISOFile.h" />
<ClInclude Include="Src\ISOProperties.h" />
<ClInclude Include="Src\LogWindow.h" />
<ClInclude Include="Src\LuaWindow.h" />
<ClInclude Include="Src\Main.h" />
<ClInclude Include="Src\MemcardManager.h" />
<ClInclude Include="Src\MemoryCards\GCMemcard.h" />
@ -375,6 +374,7 @@ xcopy "$(SolutionDir)..\Externals\SDL\$(PlatformName)\*.dll" "$(TargetDir)" /e /
<ClInclude Include="Src\NetPlay.h" />
<ClInclude Include="Src\NetWindow.h" />
<ClInclude Include="Src\PatchAddEdit.h" />
<ClInclude Include="Src\PHackSettings.h" />
<ClInclude Include="Src\stdafx.h" />
<ClInclude Include="Src\UDPConfigDiag.h" />
<ClInclude Include="Src\WiimoteConfigDiag.h" />
@ -390,9 +390,6 @@ xcopy "$(SolutionDir)..\Externals\SDL\$(PlatformName)\*.dll" "$(TargetDir)" /e /
<ProjectReference Include="..\..\..\Externals\Bochs_disasm\Bochs_disasm.vcxproj">
<Project>{cd3d4c3c-1027-4d33-b047-aec7b56d0bf6}</Project>
</ProjectReference>
<ProjectReference Include="..\..\..\Externals\Lua\Lua.vcxproj">
<Project>{bbacbc43-0607-4825-ab10-f85a743a5af8}</Project>
</ProjectReference>
<ProjectReference Include="..\..\..\Externals\LZO\LZO.vcxproj">
<Project>{d8890b98-26f7-4cff-bbfb-b95f371b5f20}</Project>
</ProjectReference>
@ -457,4 +454,4 @@ xcopy "$(SolutionDir)..\Externals\SDL\$(PlatformName)\*.dll" "$(TargetDir)" /e /
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>

View File

@ -66,9 +66,6 @@
<ClCompile Include="Src\LogWindow.cpp">
<Filter>GUI</Filter>
</ClCompile>
<ClCompile Include="Src\LuaWindow.cpp">
<Filter>GUI</Filter>
</ClCompile>
<ClCompile Include="Src\MemcardManager.cpp">
<Filter>GUI</Filter>
</ClCompile>
@ -87,6 +84,9 @@
<ClCompile Include="Src\ISOFile.cpp">
<Filter>Misc</Filter>
</ClCompile>
<ClCompile Include="Src\PHackSettings.cpp">
<Filter>GUI</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Src\Main.h" />
@ -141,9 +141,6 @@
<ClInclude Include="Src\LogWindow.h">
<Filter>GUI</Filter>
</ClInclude>
<ClInclude Include="Src\LuaWindow.h">
<Filter>GUI</Filter>
</ClInclude>
<ClInclude Include="Src\MemcardManager.h">
<Filter>GUI</Filter>
</ClInclude>
@ -165,6 +162,9 @@
<ClInclude Include="resource.h">
<Filter>Resources</Filter>
</ClInclude>
<ClInclude Include="Src\PHackSettings.h">
<Filter>GUI</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="Src\SConscript" />

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9,00"
Version="9.00"
Name="Dolphin"
ProjectGUID="{A72606EF-C5C1-4954-90AD-F0F93A8D97D9}"
RootNamespace="DolphinWX"
@ -900,14 +900,6 @@
RelativePath=".\src\LogWindow.h"
>
</File>
<File
RelativePath=".\Src\LuaWindow.cpp"
>
</File>
<File
RelativePath=".\Src\LuaWindow.h"
>
</File>
<File
RelativePath=".\src\MemcardManager.cpp"
>

View File

@ -251,7 +251,6 @@ EVT_MENU(IDM_RECORD, CFrame::OnRecord)
EVT_MENU(IDM_PLAYRECORD, CFrame::OnPlayRecording)
EVT_MENU(IDM_RECORDEXPORT, CFrame::OnRecordExport)
EVT_MENU(IDM_FRAMESTEP, CFrame::OnFrameStep)
EVT_MENU(IDM_LUA, CFrame::OnOpenLuaWindow)
EVT_MENU(IDM_SCREENSHOT, CFrame::OnScreenshot)
EVT_MENU(wxID_PREFERENCES, CFrame::OnConfigMain)
EVT_MENU(IDM_CONFIG_GFX_PLUGIN, CFrame::OnConfigGFX)

View File

@ -321,7 +321,6 @@ class CFrame : public CRenderFrame
void OnMemcard(wxCommandEvent& event); // Misc
void OnImportSave(wxCommandEvent& event);
void OnOpenLuaWindow(wxCommandEvent& event);
void OnNetPlay(wxCommandEvent& event);

View File

@ -46,7 +46,6 @@ Core::GetWindowHandle().
#include "ConfigMain.h"
#include "MemcardManager.h"
#include "CheatsWindow.h"
#include "LuaWindow.h"
#include "AboutDolphin.h"
#include "GameListCtrl.h"
#include "BootManager.h"
@ -197,7 +196,6 @@ void CFrame::CreateMenu()
// Tools menu
wxMenu* toolsMenu = new wxMenu;
toolsMenu->Append(IDM_LUA, _("New &Lua Console"));
toolsMenu->Append(IDM_MEMCARD, _("&Memcard Manager (GC)"));
toolsMenu->Append(IDM_IMPORTSAVE, _("Wii Save Import"));
toolsMenu->Append(IDM_CHEATS, _("&Cheats Manager"));
@ -1221,11 +1219,6 @@ void CFrame::OnImportSave(wxCommandEvent& WXUNUSED (event))
}
}
void CFrame::OnOpenLuaWindow(wxCommandEvent& WXUNUSED (event))
{
new wxLuaWindow(this, wxDefaultPosition, wxSize(600, 390));
}
void CFrame::OnShow_CheatsWindow(wxCommandEvent& WXUNUSED (event))
{
CheatsWindow = new wxCheatsWindow(this);

View File

@ -93,7 +93,6 @@ enum
IDM_PROPERTIES,
IDM_LOAD_WII_MENU,
IDM_INSTALL_WII_MENU,
IDM_LUA,
IDM_CONNECT_WIIMOTE1,
IDM_CONNECT_WIIMOTE2,
IDM_CONNECT_WIIMOTE3,

View File

@ -1,236 +0,0 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#include "LuaWindow.h"
#include "LuaInterface.h"
#include "../../Core/Src/CoreTiming.h"
#include <map>
int wxLuaWindow::luaCount = 0;
// Constant Colors
const unsigned long COLOR_GRAY = 0xDCDCDC;
BEGIN_EVENT_TABLE(wxLuaWindow, wxWindow)
EVT_SIZE( wxLuaWindow::OnEvent_Window_Resize)
EVT_CLOSE( wxLuaWindow::OnEvent_Window_Close)
EVT_BUTTON(ID_BUTTON_CLOSE, wxLuaWindow::OnEvent_ButtonClose_Press)
EVT_BUTTON(ID_BUTTON_LOAD, wxLuaWindow::OnEvent_ScriptLoad_Press)
EVT_BUTTON(ID_BUTTON_RUN, wxLuaWindow::OnEvent_ScriptRun_Press)
EVT_BUTTON(ID_BUTTON_STOP, wxLuaWindow::OnEvent_ScriptStop_Press)
EVT_BUTTON(ID_BUTTON_CLEAR, wxLuaWindow::OnEvent_ButtonClear_Press)
END_EVENT_TABLE()
std::map<int, wxLuaWindow *> g_contextMap;
static int ev_LuaOpen, ev_LuaClose, ev_LuaStart, ev_LuaStop;
void LuaPrint(int uid, const char *msg)
{
g_contextMap[uid]->PrintMessage(msg);
}
void LuaStop(int uid, bool ok)
{
if(ok)
g_contextMap[uid]->PrintMessage("Script completed successfully!\n");
//else // disabled because this message makes no sense in certain contexts, and there's always an earlier error message anyway.
// g_contextMap[uid]->PrintMessage("Script failed.\n");
g_contextMap[uid]->OnStop();
}
wxLuaWindow::wxLuaWindow(wxFrame* parent, const wxPoint& pos, const wxSize& size) :
wxFrame(parent, wxID_ANY, _("Lua Script Console"), pos, size, wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE)
{
LuaWindow_InitFirstTime();
// Create Lua context
luaID = luaCount;
luaCount++;
CoreTiming::ScheduleEvent_Threadsafe_Immediate(ev_LuaOpen, luaID);
g_contextMap[luaID] = this;
bScriptRunning = false;
// Create the GUI controls
InitGUIControls();
// Setup Window
SetBackgroundColour(wxColour(COLOR_GRAY));
SetSize(size);
SetPosition(pos);
Layout();
Show();
}
wxLuaWindow::~wxLuaWindow()
{
// On Disposal
CoreTiming::ScheduleEvent_Threadsafe_Immediate(ev_LuaClose, luaID);
g_contextMap.erase(luaID);
}
void wxLuaWindow::PrintMessage(const char *text)
{
m_TextCtrl_Log->AppendText(wxString::FromAscii(text));
}
void wxLuaWindow::InitGUIControls()
{
// $ Log Console
m_Tab_Log = new wxPanel(this, ID_TAB_LOG, wxDefaultPosition, wxDefaultSize);
m_TextCtrl_Log = new wxTextCtrl(m_Tab_Log, ID_TEXTCTRL_LOG, wxT(""), wxDefaultPosition, wxSize(100, 600),
wxTE_MULTILINE | wxTE_READONLY | wxTE_DONTWRAP);
wxBoxSizer *HStrip1 = new wxBoxSizer(wxHORIZONTAL);
wxBoxSizer *sTabLog = new wxBoxSizer(wxVERTICAL);
sTabLog->Add(HStrip1, 0, wxALL, 5);
sTabLog->Add(m_TextCtrl_Log, 1, wxALL|wxEXPAND, 5);
m_Tab_Log->SetSizer(sTabLog);
m_Tab_Log->Layout();
// Button Strip
m_Button_Close = new wxButton(this, ID_BUTTON_CLOSE, _("Close"), wxDefaultPosition, wxDefaultSize);
m_Button_LoadScript = new wxButton(this, ID_BUTTON_LOAD, _("Load Script..."), wxDefaultPosition, wxDefaultSize);
m_Button_Run = new wxButton(this, ID_BUTTON_RUN, _("Run"), wxDefaultPosition, wxDefaultSize);
m_Button_Stop = new wxButton(this, ID_BUTTON_STOP, _("Stop"), wxDefaultPosition, wxDefaultSize);
m_Button_Clear = new wxButton(this, ID_BUTTON_CLEAR, _("Clear"), wxDefaultPosition, wxDefaultSize);
wxBoxSizer* sButtons = new wxBoxSizer(wxHORIZONTAL);
m_Button_Run->Disable();
m_Button_Stop->Disable();
sButtons->Add(m_Button_Close, 0, wxALL, 5);
sButtons->Add(m_Button_LoadScript, 0, wxALL, 5);
sButtons->Add(m_Button_Run, 0, wxALL, 5);
sButtons->Add(m_Button_Stop, 0, wxALL, 5);
sButtons->Add(m_Button_Clear, 0, wxALL, 5);
wxBoxSizer* sMain = new wxBoxSizer(wxVERTICAL);
sMain->Add(m_Tab_Log, 1, wxEXPAND|wxALL, 5);
sMain->Add(sButtons, 0, wxALL, 5);
SetSizer(sMain);
Layout();
Fit();
}
void wxLuaWindow::OnEvent_ScriptLoad_Press(wxCommandEvent& WXUNUSED(event))
{
wxString path = wxFileSelector(
_("Select the script to load"),
wxEmptyString, wxEmptyString, wxEmptyString,
wxString::Format
(
_T("Lua Scripts (lua)|*.lua|All files (%s)|%s"),
wxFileSelectorDefaultWildcardStr,
wxFileSelectorDefaultWildcardStr
),
wxFD_OPEN | wxFD_PREVIEW | wxFD_FILE_MUST_EXIST,
this);
if(!path.IsEmpty())
currentScript = path;
else
return;
m_TextCtrl_Log->Clear();
m_TextCtrl_Log->AppendText(wxString::FromAscii(
StringFromFormat("Script %s loaded successfully.\n",
(const char *)path.mb_str()).c_str()));
m_Button_Run->Enable();
}
void wxLuaWindow::OnEvent_ScriptRun_Press(wxCommandEvent& WXUNUSED(event))
{
m_TextCtrl_Log->AppendText(_("Running script...\n"));
bScriptRunning = true;
m_Button_LoadScript->Disable();
m_Button_Run->Disable();
m_Button_Stop->Enable();
CoreTiming::ScheduleEvent_Threadsafe_Immediate(ev_LuaStart, luaID);
}
void wxLuaWindow::OnEvent_ScriptStop_Press(wxCommandEvent& WXUNUSED(event))
{
CoreTiming::ScheduleEvent_Threadsafe_Immediate(ev_LuaStop, luaID);
OnStop();
PrintMessage("Stopping script...\n");
}
void wxLuaWindow::OnStop()
{
bScriptRunning = false;
m_Button_LoadScript->Enable();
m_Button_Run->Enable();
m_Button_Stop->Disable();
}
void wxLuaWindow::OnEvent_ButtonClear_Press(wxCommandEvent& WXUNUSED (event))
{
m_TextCtrl_Log->Clear();
}
void wxLuaWindow::OnEvent_Window_Resize(wxSizeEvent& WXUNUSED (event))
{
Layout();
}
void wxLuaWindow::OnEvent_ButtonClose_Press(wxCommandEvent& WXUNUSED (event))
{
Destroy();
}
void wxLuaWindow::OnEvent_Window_Close(wxCloseEvent& WXUNUSED (event))
{
Destroy();
}
// this layer of event stuff is because Lua needs to run on the CPU thread
void wxLuaWindow::LuaOpenCallback(u64 userdata, int)
{
Lua::OpenLuaContext((int)userdata, LuaPrint, NULL, LuaStop);
}
void wxLuaWindow::LuaCloseCallback(u64 userdata, int)
{
Lua::CloseLuaContext((int)userdata);
}
void wxLuaWindow::LuaStartCallback(u64 userdata, int)
{
int lid = (int)userdata;
Lua::RunLuaScriptFile(lid,
(const char *)g_contextMap[lid]->currentScript.mb_str());
}
void wxLuaWindow::LuaStopCallback(u64 userdata, int)
{
Lua::StopLuaScript((int)userdata);
}
void wxLuaWindow::LuaWindow_InitFirstTime()
{
static bool initialized = false;
if(!initialized)
{
ev_LuaOpen = CoreTiming::RegisterEvent("LuaOpen", &wxLuaWindow::LuaOpenCallback);
ev_LuaClose = CoreTiming::RegisterEvent("LuaClose", &wxLuaWindow::LuaCloseCallback);
ev_LuaStart = CoreTiming::RegisterEvent("LuaStart", &wxLuaWindow::LuaStartCallback);
ev_LuaStop = CoreTiming::RegisterEvent("LuaStop", &wxLuaWindow::LuaStopCallback);
initialized = true;
}
}

View File

@ -1,105 +0,0 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef __LUAWINDOW_H__
#define __LUAWINDOW_H__
#include <wx/wx.h>
#include <wx/sizer.h>
#include <wx/filepicker.h>
#include <wx/statbmp.h>
#include <wx/imaglist.h>
#include <wx/treectrl.h>
#include <wx/gbsizer.h>
#include <wx/notebook.h>
#include <wx/mimetype.h>
#include <wx/colour.h>
#include <wx/listbox.h>
#include <string>
#include "Filesystem.h"
#include "IniFile.h"
class wxLuaWindow : public wxFrame
{
public:
wxLuaWindow(wxFrame* parent, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize);
void PrintMessage(const char *text);
void OnStop();
virtual ~wxLuaWindow();
protected:
static int luaCount;
int luaID;
bool bScriptRunning;
wxString currentScript;
// Event Table
DECLARE_EVENT_TABLE();
// --- GUI Controls ---
wxPanel *m_Tab_Log;
wxButton *m_Button_Close, *m_Button_LoadScript, *m_Button_Run,
*m_Button_Stop, *m_Button_Clear;
wxTextCtrl *m_TextCtrl_Log;
// GUI IDs
enum
{
ID_TAB_LOG,
ID_BUTTON_CLOSE,
ID_BUTTON_LOAD,
ID_BUTTON_RUN,
ID_BUTTON_STOP,
ID_BUTTON_CLEAR,
ID_TEXTCTRL_LOG
};
void InitGUIControls();
// --- Wx Events Handlers ---
// $ Window
void OnEvent_Window_Resize(wxSizeEvent& event);
void OnEvent_Window_Close(wxCloseEvent& event);
// $ Buttons
void OnEvent_ButtonClose_Press(wxCommandEvent& event);
void OnEvent_ScriptLoad_Press(wxCommandEvent& event);
void OnEvent_ScriptRun_Press(wxCommandEvent& event);
void OnEvent_ScriptStop_Press(wxCommandEvent& event);
void OnEvent_ButtonClear_Press(wxCommandEvent& event);
// -- CoreTiming-style event handlers --
static void LuaOpenCallback(u64 userdata, int cyclesLate);
static void LuaCloseCallback(u64 userdata, int cyclesLate);
static void LuaStartCallback(u64 userdata, int cyclesLate);
static void LuaStopCallback(u64 userdata, int cyclesLate);
static void LuaWindow_InitFirstTime();
};
#endif

View File

@ -148,9 +148,9 @@ void CPHackSettings::OnClose(wxCloseEvent& WXUNUSED (event))
void CPHackSettings::SavePHackData(wxCommandEvent& WXUNUSED (event))
{
PHack_Data.PHackSZNear = (bool)PHackSZNear->Get3StateValue();
PHack_Data.PHackSZFar = (bool)PHackSZFar->Get3StateValue();
PHack_Data.PHackExP = (bool)PHackExP->Get3StateValue();
PHack_Data.PHackSZNear = PHackSZNear->GetValue();
PHack_Data.PHackSZFar = PHackSZFar->GetValue();
PHack_Data.PHackExP = PHackExP->GetValue();
PHack_Data.PHZNear = PHackZNear->GetValue().char_str();
PHack_Data.PHZFar = PHackZFar->GetValue().char_str();

View File

@ -22,7 +22,6 @@ else:
'Frame.cpp',
'FrameAui.cpp',
'FrameTools.cpp',
'LuaWindow.cpp',
'LogWindow.cpp',
'GameListCtrl.cpp',
'HotkeyDlg.cpp',
@ -54,7 +53,7 @@ libs += ['core', 'common', 'discio', 'plugin_videoogl', 'plugin_videosoftware']
if env['HAVE_WX']:
libs += ['videouicommon']
libs += ['audiocommon', 'inputcommon', 'videocommon']
libs += ['GLEW', 'SOIL', 'bdisasm', 'lua', 'lzo2', 'sfml-network', 'z']
libs += ['GLEW', 'SOIL', 'bdisasm', 'lzo2', 'sfml-network', 'z']
if sys.platform == 'win32':
files += [ "stdafx.cpp" ]